Ant needs tools.jar and unable to find it

后端 未结 10 2075
温柔的废话
温柔的废话 2021-01-30 16:27

I am putting together a dev environment for a Java program and after the first try of my Ant build scripts I got this error:

Unable to locate tools.jar. Expected         


        
10条回答
  •  名媛妹妹
    2021-01-30 17:00

    Even if you have jdk installed, you'll need to redirect JAVA_HOME to point to it.

    Here's one weird trick you can put into your .profile to set JAVA HOME properly, no matter which java you have:

    export JAVA_HOME=$(dirname $(dirname $(readlink -e /usr/bin/java)))
    # Test for jdk installed above jre
    if [ -x $JAVA_HOME/../bin/java ]; then export JAVA_HOME=$(dirname $JAVA_HOME); fi
    

提交回复
热议问题