gpt4 book ai didi

执行maven时出现Javaclasses.jar'could not find错误

转载 作者:行者123 更新时间:2023-12-01 10:21:11 24 4
gpt4 key购买 nike

我刚刚在 Mac El Captain 上安装了 java 8 和 maven。我已正确设置所有环境变量,并且 java -version 确实显示了 java 版本。但是当我尝试从终端运行 Maven 时,出现以下错误:

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)

有什么想法吗?

最佳答案

对于 Maven 1.x,我发现以下 bin/maven shell 脚本在 Mac 上对我造成了同样的错误:

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

我只是编辑了 bin/maven 脚本文件并注释掉了 if $darwin; then ... fi 部分,现在可以正常工作了。

关于执行maven时出现Javaclasses.jar'could not find错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35607138/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com