I downloaded language support for Java by Red Hat in Microsoft Visual Studio Code,
but I got a problem as shown in the above picture.
So I tried to set my JDK path in the settings.json
file in VSCode:
"java.home": "C:/ProgramFiles/Java/jdk1.8.0_111"
But the problem is still not solved.
Do you know how to solve this problem?
You can use VS Code to read, write, run, and debug Java source file(s) without creating a project. VS Code for Java supports two modes, lightweight and standard.
Overall, Visual Studio Code is very good as a Java IDE if you install the Extension Pack for Java. It's merely OK as a Java editor without the extension pack, as becomes obvious when you run Visual Studio Code for the Web.
You have to restart VS Code after entering the java.home variable in the settings file.
Alternatively, setting that variable isn't even required. You can remove it from your settings and VS Code will automatically check your user/system environment variables for JDK_HOME and JAVA_HOME.
See "Setting the JDK" at https://marketplace.visualstudio.com/items?itemName=redhat.java
For information on how to set the environment variables, see Environment variables for java installation
you should change the path to be like this:
"java.home":"C:\\Program Files\\Java\\jdk1.8.0_111"
My Visual Studio Code is set to use the 32 bit version of JDK
A default java.exe is installed in your %SYSTEMROOT%\System32
Check java version from command line:
java -version
You might need to add your version to PATH:
set PATH=%PATH%;C:\Program Files (x86)\Java\jdk1.8.0_111\bin
And set your system JAVA_HOME:
setx -m JAVA_HOME "C:\Program Files (x86)\Java\jdk1.8.0_111"
Restart cmd and try:
echo %JAVA_HOME%
Restart Visual Studio Code and be happy.
Use set
instead of setx
for local user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With