0

Error: could not open `D:\IntelliJ IDEA Community Edition 2018.2.5\JDK\lib\amd64\jvm.cfg'

I get this error every time I try to run a java program. Before it was working fine when i had JDK 8 but i upgraded to 14. I use VScode and I had deleted Intellij but the file path hasn't gone and the terminal is trying to find the intelliJ JDK for some reason. I am a beginner to terminal too. I have tried setting up the environment variable for the correct path but that isn't working.The path variable doesn't have the intelliJ reference in it and i have even set up the JDK_HOME but even that isn't working.

Edit: I have downloaded a extension called Terminal Manager but don't know how to configure it.Will it work?(Edit: It doesn't, it's not what i thought it is used for)

Yet another edit: Is there a way to specify the path for JDK every time I use java commands in the terminal and does it have auto-completion(using tab). Should i just reset my machine because i can't seem to figure out this problem.

Where java in the command prompt gives C:\Program Files (x86)\Common Files\Oracle\Java\javapath\java.exe, not the path for the JDK 14. I updated the environment var path to point to the latest JDK but now i get INFO: Could not find files for the given pattern(s). in the command prompt.

In VScode, on opening the Configure JavaRuntime,That is showing me 4 paths, 2 are the correct ones(one is labelled current), one empty and the invalid path. I can't seem to find any way to remove the incorrect one. Though it has the correct path, it still searches for the deleted file.

Update: The program now compiles but every time it shows:

 Build Failed
 Debugger for Java
 Proceed Fix Cancel

I click fix and clear the workspace cache but it doesn't work. It runs without the debugger but it would be better if it worked.

12
  • Look for PATH environment variable. Remove the IntelliJ reference from the path. The PATH variable should contain the JDK 14 path. Commented Aug 11, 2020 at 17:01
  • The path variable doesn't have the intelliJ reference, just VScode and python(i use that too) paths plus some other system paths. Commented Aug 12, 2020 at 2:58
  • You wrote in your question: every time I try to run a java program How exactly do you try to run a java program? Do you open a command prompt window and enter java ... ? Commented Aug 12, 2020 at 7:13
  • Yes, i write java <class name> in the in-built terminal. Commented Aug 12, 2020 at 7:13
  • Open a Command Prompt window and enter the command where java. What is the output of that command? Commented Aug 12, 2020 at 11:37

1 Answer 1

0

Install the "choose runtime" plugin this will allow you to select the runtime your self. Start the IDE, use (Ctrl+Shift+A or Cmd+Shift+A on Mac), type "Choose Runtime", press Enter. You will be able to download the latest version from here and it will be automatically configured to the config path

Sign up to request clarification or add additional context in comments.

3 Comments

Isn't that a IntelliJ plugin, i am using VScode and have deleted intelliJ, thats why im getting that error.
ohh sorry for the confusionSettings for the JDK# To access various settings for using the JDK, bring up the Command Palette (Shift +CMD + P) and use the command Java: Configure Java Runtime. You should be able to point to the correct path here
That is showing me 4 paths, 2 are the correct ones(one is labelled current), one empty and the invalid path. I can't seem to find any way to remove the incorrect one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.