簡體   English   中英

Ubuntu上的Ant出現“無法找到javac編譯器”錯誤

[英]“Unable to find a javac compiler” error with Ant on Ubuntu

我正在使用Apache Ant在Ubuntu上構建aprofplot。 在包含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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM