开发者

Error building java eclipse project via ant from command-line

开发者 https://www.devze.com 2023-03-03 15:09 出处:网络
I\'m trying to build an eclipse project with ant via the command line.The build.xml file works great when I run开发者_如何学运维 it in java, but when I cd to the project directory(where build.xml is l

I'm trying to build an eclipse project with ant via the command line. The build.xml file works great when I run开发者_如何学运维 it in java, but when I cd to the project directory(where build.xml is located) and run ant -f build.xml I get the following error msg:

Unable to locate tools.jar. Expected to find it in /usr/lib/jvm/java-6-openjdk/lib/tools.jar
Buildfile: build.xml

clean:
   [delete] Deleting directory /home/adam/workspace/pfaat/classes

build:
    [mkdir] Created dir: /home/adam/workspace/pfaat/classes
    [javac] Compiling 502 source files to /home/adam/workspace/pfaat/classes

BUILD FAILED
/home/adam/workspace/pfaat/build.xml:86: 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-6-openjdk/jre"

Total time: 0 seconds

Is there a way for me to specify the compiler from the command line w/o changing the build.xml? Again, it works fine when I run it with eclipse, and I haven't found anything in the eclipse or ant manual that should suggest it wouldn't. BTW, I'm running ubuntu 10.04. Thank you very much for your time. Adam


set PATH that points to tools.jar make sure that it have tools.jar file

use

export PATH=$PATH:/usr/java/jdk1.5.0_07/bin


Your JAVA HOME path is set to your JRE. Ant needs JDK to work from command line.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号