简体   繁体   中英

Java classes.jar' could not be found error when executing maven

I just installed java 8 and maven on Mac El Captain. I have set all the environment variables correctly and java -version does display the java version. But when I try to run maven from the terminal I get the following error:

File or url '/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar' could not be found
java.net.MalformedURLException: no protocol: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar
    at java.net.URL.<init>(URL.java:593)
    at java.net.URL.<init>(URL.java:490)
    at java.net.URL.<init>(URL.java:439)
    at com.werken.forehead.Forehead.loadFileOrUrl(Forehead.java:403)
    at com.werken.forehead.Forehead.load(Forehead.java:322)
    at com.werken.forehead.Forehead.config(Forehead.java:245)
    at com.werken.forehead.Forehead.config(Forehead.java:131)
    at com.werken.forehead.Forehead.main(Forehead.java:579)

any ideas?

For Maven 1.x, I found the following bit of the bin/maven shell script caused the same error for me on a Mac:

if $darwin; then
    TOOLS_JAR="/System/Library/Frameworks/JavaVM.framework/Versions/${JAVA_VERSION}/Classes/classes.jar"
fi

I simply edited the bin/maven script file and commented out the if $darwin; then ... fi if $darwin; then ... fi section and it is now working.

The pass where classes

java.net.MalformedURLException: no protocol: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Classes/classes.jar

I would guess its 'JavaVM.framework' or really amissing protocol like 'file:'

If you installed the JDK in a path like JavaVM.framework, try to installit in another path without '.'

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