24

Installed intellij and added sdk path to project structure, but when i try to run i get:

Error: Cannot run program "/home/$USER/java/jdk1.8.0_121/bin/java" 
(in directory"/home/$USER/.intelliJIdea2016.3/system/compile-server"):
error=2, No such file or directory

Both files (/home/$USER/java/jdk1.8.0_121/bin/java and /home/$USER/.intelliJIdea2016.3/system/compile-server) exists.

I am using Ubuntu 16.10

8
  • What OS do you use? Are you sure it's the full JDK installation path and not a JRE?
    – CrazyCoder
    Commented Mar 17, 2017 at 11:55
  • @CrazyCoder I am using ubuntu 16.10 and i downloaded the JDK from oracle.com/technetwork/java/javase/downloads/…, the path is to the extracted folder
    – A.Jac
    Commented Mar 17, 2017 at 12:06
  • Please specify what OS do you use. As of now, question is unclear.
    – Malakai
    Commented Mar 17, 2017 at 13:14
  • Do you see $USER in the error message or did you replace it when posting the question?
    – CrazyCoder
    Commented Mar 17, 2017 at 23:38
  • @CrazyCoder $USER is my replacement of my username
    – A.Jac
    Commented Mar 20, 2017 at 7:34

5 Answers 5

37

The answer from here Change jdk path in IntelliJ 13 when compiling from 32 bit program file folder to 64 bit one worked for me

From the menu: File -> Project Structure....

On the left, below "Platform Settings", you have "SDKs": click on it; you can add your new JDK here.

Always in the same window, below "Project Settings", select "Project": you have the option to select the JDK which you just added.

1
  • This answer fixed my issue. Thank you!
    – JIANG
    Commented Apr 1, 2021 at 13:57
2

In my case, IntelliJ was pointing to a JDK folder of a version I had uninstalled. For some reason the uninstaller didnt remove the Java/jdk* folder, so it was not showing any error in the configuration screen File -> Project Structure -> SDK

After finding out it was pointing to an uninstalled JDK folder then I proceeded to adjust this configuration thanks to the answer posted by UberHans

0

Make sure your JDK path is correct. In my case, it updated JDK version somehow but I didn't notice it, there are a lot of red underlines. After I edit JDK with the correct path, the world became green.

0

1-see your version system, is window, mac or linux?

2-dowload specifc jdk(mac, window, linux).

3-Cheked your folders and file requered and path jdk/bin/(exec java)

4-see if the execut file java is compatibile your, system in your folder bin

1
  • As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Dec 24, 2021 at 14:42
0

Did you try doing a Maven Reload? I had the same issue, and i tried everything, nothing worked, the only thing that worked, was reloading Maven, it fixed the problem. I hope it helps.

Not the answer you're looking for? Browse other questions tagged or ask your own question.