Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The java.home variable defined in VS Code settings points to a missing folder #690

Closed
danieltedev opened this issue Oct 25, 2018 · 26 comments

Comments

@danieltedev
Copy link

danieltedev commented Oct 25, 2018

The java.home variable defined in VS Code settings points to a missing folder

Environment
  • Operating System: windows 7 64
  • JDK version: jdk1.8.0_191
  • Visual Studio Code version: 1.28.2
  • Java extension version: 0.33.0
Steps To Reproduce

user settings vscode: "java.home": "C:\Program Files\Java\jdk1.8.0_161"
system environment variable: name variable = JAVA_HOME / value variable = c:\Program Files\Java\jdk1.8.0_191
system environment variable: name variable = JDK_HOME / value variable = c:\Program Files\Java\jdk1.8.0_191

error: The java.home variable defined in VS Code settings points to a missing folder

I have already taken a look at all the problems already reported but I did not find a solution, can you help me?

@snjeza
Copy link
Contributor

snjeza commented Oct 25, 2018

You can try the following;

"java.home": "C:\\Program Files\\Java\\jdk1.8.0_191\\",

@Inukares
Copy link

Inukares commented Oct 26, 2018

Below worked for me.

"java.home": "C:\\Program Files\\Java\\jdk1.8.0_191",

As vsCode docs say, on Windows you have to escape "\" character while setting java.home json in vsCode's settings.

@danieltedev
Copy link
Author

danieltedev commented Oct 26, 2018

good morning, i already tried "java.home": "C:\Program Files\Java\jdk1.8.0_191\" but not working @snjeza....
thank for helping me!!!

I going continue trying

sorry for my english

@fbricon
Copy link
Collaborator

fbricon commented Oct 26, 2018

@danieltedev did you try to use double backslashes? (\\)

@danieltedev
Copy link
Author

sorry my message removed the double backslashes, but yes, I used double backslashes

@fbricon
Copy link
Collaborator

fbricon commented Oct 26, 2018

have you tried using forward slashes (/) instead?
"java.home": "C:/Program Files/Java/jdk1.8.0_191"?

@Inukares
Copy link

You say that you've set the settings in vsCode to point to \jdk1.8.0_161, but in env variable you have \jdk1.8.0_191
Maybe you wrote wrong sdk version?

@danieltedev
Copy link
Author

I sorry, I should have talked about all the tests I did....

I already tried:
"java.home": "C:\Program Files\Java\jdk1.8.0_191\",
"java.home": "C:\Program Files\Java\jdk1.8.0_191"
"java.home": "C:/Program Files/Java/jdk1.8.0_191/",
"java.home": "C:/Program Files/Java/jdk1.8.0_191",

@Agredo
Copy link

Agredo commented Oct 29, 2018

I have the same problem. Cant use Java in VS Code.

@danieltedev
Copy link
Author

Sorry I figured out what I did wrong, I put the settings inside the workspace and for this reason it was not working.

@apsmono
Copy link

apsmono commented Jul 15, 2019

what did you mean by this??

Sorry I figured out what I did wrong, I put the settings inside the workspace and for this reason it was not working.

@vintprox
Copy link

vintprox commented Oct 16, 2019

Bruh. I set following in User Settings:

    "java.home": "C:\\Program Files\\RedHat\\java-1.8.0-openjdk-1.8.0.222-4"

But it still cannot locate actually installed JDK.

Using path to Java SE Development Kit C:\\Program Files\\Java\\jdk-13.0.1 doesn't help either.

@iaxat
Copy link

iaxat commented Dec 19, 2019

Same problem

@ditordccaa
Copy link

I had the same problem. What I did additionally is setting the environment variable too.
export JAVA_HOME=C:/Program Files/Java/jdk1.8.0_131
and it worked.
Cheers,

@fcastresana
Copy link

Hi! i had the same problem. try downloading this AdoptOpenJDK\jdk-11.0.8.10-hotspot\ then configure your system variables like this tutorial https://javatutorial.net/set-java-home-windows-10
other important thing check if you have two java versions installed and uninstall the one you dont need.

@alishah730
Copy link

alishah730 commented Aug 10, 2020

this is my java home in mac and still getting same issue
"java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home"

image

@veedata
Copy link

veedata commented Aug 13, 2020

this is my java home in mac and still getting same issue
"java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home"

image

Hey, i was facing the same issue, i tried all the solutions above but they did not work and still gave an error.
It seems to be a problem with the Red Hat extension. It required Java 11 minimum. To bypass this i went to a version of the extension where this wasn't the case
What fixed it for me was downgrading to v0.62.0 (maybe it works in a more recent )

This is not a fix in itself, so, i hope someone does find a better way out, but till that point in time, this is a monkey fix

@fbricon
Copy link
Collaborator

fbricon commented Aug 13, 2020

Since vscode-java 0.65.0, "java.home" needs to point to a JDK 11 installation, so the Java Language Server can run.

You can still use a JDK 1.8 (actually anything from 1.5 to 14) to compile your projects, if you configure the "java.configuration.runtimes" preference, as documented in https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements.

@iaxat
Copy link

iaxat commented Aug 14, 2020

I have found the solution for this issue that worked for me, I installed the Java.deb file and then the issue got removed.

https://gofile.io/d/lNjQkz

@thanhle7
Copy link

thanhle7 commented Sep 25, 2020

Better using java.home settings by workspace. Given vscode for mobile app dev using react-native with 32-bit JDK but some Java apps using 64-bit JDK version of 11 or later, workspace settings should help.

@bphariharan1301
Copy link

You can try the following;

"java.home": "C:\\Program Files\\Java\\jdk1.8.0_191\\",

are you sure that it's working??
Since, i tried and its not working..

@victorbombella
Copy link

I just had the same problem and I noticed that the problem was in the workspace configuration, so, you need to change the "java.home" path in both, User json and Workspace json, following the rule of using "\" (doble slash) and setting the same path in both.

@LaoLiulaoliu
Copy link

I met the same problem too in win10 with settings.json "java.home": "C:\Program Files\Java\jdk-11.0.10",

@Eskibear
Copy link
Contributor

Eskibear commented Feb 4, 2021

@LaoLiulaoliu

following the rule of using \\ (doble slash)

@bphariharan1301
As mentioned in #690 (comment) , it requires JDK 11+ to launch the language server itself.

@Thengsenghong
Copy link

Bruh. I set following in User Settings:

    "java.home": "C:\\Program Files\\RedHat\\java-1.8.0-openjdk-1.8.0.222-4"

But it still cannot locate actually installed JDK.

Using path to Java SE Development Kit C:\\Program Files\\Java\\jdk-13.0.1 doesn't help either.

java.home is deprecated please use "java.jdt.ls.java.home" in stead.

@huykon
Copy link

huykon commented Apr 17, 2024

I'm facing with same issue on my ubuntu vscode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests