Terminal searching JDK in wrong PATH/Build failed, debugger for java

旧巷老猫 提交于 2021-02-11 12:32:29

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/63362466/terminal-searching-jdk-in-wrong-path-build-failed-debugger-for-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!