简体   繁体   中英

Java - ant cannot find rt.jar

I'm compiling DrJava by following these instructions.

But when I run ant jar , I get the error:

/Users/arthur/dj/drjava/build.xml:1270: Can't find rt.jar in the Java 7 home: ${env.JAVA7_HOME}

I know that rt.jar is in /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/jre/lib .

How do I fix it?

This answer is same as what others have provided - just a little more detailed. So what you simply need is type this on your shell:

export JAVA7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/jre/lib

Now you have mentioned I know that rt.jar is in /Library/Java/JavaVirtualMachines/jdk1.7.0_07.jdk/Contents/Home/jre/lib.

Usually you would not have Contents/Home inside JDK. A standard Java installation should have jdk1.7.0_07.jdk/jre/lib . Check if you have provided the correct path above and rt.jar is indeed in there.

您应该确保将蚂蚁指向JDK而不是JRE。

将路径设置为JDK。这将解决此问题。

I ran into this same problem. Pulak was close, but not quite right: you don't need the jre/lib part at the end. The command that ultimately did the trick for me was:

export JAVA7_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_60.jdk/Contents/Home/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM