问题描述
日志显示此
"error=2, No such file or directory"
"Cannot run program /Applications/IntelliJ IDEA.app/Contents/jre/jdk/Contents/Home/bin/java" (in directory "/Users/.. " and a path to a directory that exists.
我可以复制运行hello world应用程序的错误,没有任何类型的依赖关系和配置(没有maven,没有spring) 。
I could replicate the error running a "hello world" app without any type of dependencies and configs (no maven, no spring).
我正在使用Intellij 2016和OSX El Capitan
I'm using Intellij 2016, and OSX El Capitan
推荐答案
问题在于引用了Intellij中捆绑的SDK。
The problem was with the SDK that was referencing the one that is bundled inside Intellij.
我可以通过更改sdk并引用Intellij之外的那个来解决它。
这可以通过文件>项目结构> SDK 完成,并在JDK Home Path中放置SDK的路径(在我的情况下 / Library / Java / JavaVirtualMachines / jdk1.8.0_65.jdk / Contents / Home
)。
I could solve it by changing the sdk and referencing the one outside Intellij.This can be done going to File > Project Structure > SDKs and in "JDK Home Path" put the path to the SDK (in my case /Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home
).
这篇关于运行Java应用程序时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!