java 程序运行出错,运行Java应用程序时出错

The log shows this

"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.

I could replicate the error running a "hello world" app without any type of dependencies and configs (no maven, no spring).

I'm using Intellij 2016, and OSX El Capitan

解决方案

The problem was with the SDK that was referencing the one that is bundled inside Intellij.

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).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值