我正在使用Apache Ant在Ubuntu上构建profplot。当我在包含build.xml的文件夹中输入命令ant时,得到以下错误:
BUILD FAILED
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:923: The following error occurred while executing this line:
/home/ashwin/aprof/aprofplot/nbproject/build-impl.xml:263: Unable to find a javac compiler;
com.sun.tools.javac.Main is not on the classpath.
Perhaps JAVA_HOME does not point to the JDK.
It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"
Total time: 2 seconds
ashwin@ashwin-VirtualBox:~/aprof/aprofplot$ javac --version
The program 'javac' can be found in the following packages:
* default-jdk
* ecj
* gcj-4.8-jdk
* openjdk-7-jdk
* gcj-4.6-jdk
* openjdk-6-jdk
我也安装了openjdk。我做错了什么?我必须安装其他软件包吗?
看来,你有错误的JAVA_HOME
变量。它从输出指向JRE:
It is currently set to "/usr/lib/jvm/java-7-openjdk-amd64/jre"
没有JDK。这就是Ant无法定位javac并失败的原因。你必须修改它。尝试在最后删除jre
,看起来,javac应该在/usr/lib/jvm/java-7-openjdk-amd64/bin
下。所以你必须将其设置为/usr/lib/jvm/java-7-openjdk-amd64