Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error while running Java app

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

like image 988
Carlos Avatar asked Aug 17 '16 13:08

Carlos


People also ask

Why can't I run Java application?

Verify that Java is enabled in the Java Control panel If Java is not enabled in the Java Control Panel, you will be unable to run Java applications in any browser.


1 Answers

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

like image 152
Carlos Avatar answered Sep 17 '22 16:09

Carlos