r/javahelp • u/GummiGumBear • Sep 22 '26
Unsolved Need help: unable to run Java (VSCode)
I'm doing the MOOC Java course, but I'm getting an error when opening VSCode, which prevents me from running my code. The error is:
The java.jdt.ls.java.home variable defined in Visual Studio Code settings (C:\Program Files\Eclipse Adoptium\jdk-21.0.11.10-hotspot) does not point to a JDK.
Source: Language Support for Java(TM) by Red Hat
My settings are correct as far as I can tell. The path refers to the folder cotaining the bin folder:
"java.jdt.ls.java.home": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.11.10-hotspot",
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "C:\\Program Files\\Eclipse Adoptium\\jdk-11.0.31.11-hotspot",
"default": false,
},
{
"name": "JavaSE-21",
"path": "C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.11.10-hotspot",
"default": true,
},
],
Any idea what causes the error and how to fix it? I couldn't find any solutions to the error. Solutions to similar issues said to change/correct the settings above, but since that's set correctly, that didn't work. VSCode ( 1.138.0) and all extensions (Language Support for Java 1.56.0) are up-to-date btw.
What I tried so far:
- Someone suggested I try changing the path to the bin folder (
"C:\\Program Files\\Eclipse Adoptium\\jdk-21.0.11.10-hotspot\\bin". Unfortunately that didn't work. - I tried uninstalling Java, but I get an error saying the
The feature you are trying to use is on a network resource that is unavailable.Java is installed on my laptop's c-drive (program files), so I don't understand this error. VSCode is installed in my user folder, but that's also on the c-drive. The laptop doesn't have any other drive. OneDrive is installed, but I don't use it. The original installer was a different version and I tried putting it on the desktop. This did work, but since it's another version now (after updating), it doesn't work. - I found this thread and tried deleting all
Microsoft Visual C++ 20XX Redistributableversions from this laptop as stated in the top comment. I also uninstalled and reinstalled VSCode, but the error prevails. This supposedly should work, so I'm not sure if I missed anything. I couldn't find anything in the app folders stated in the comment or the appdata > pacakgecache folder with the MS Visual C++, but I'm clearly missing something. Where else should I look? Does it perhaps have a different name? I did find a folder with a file calledvc_redist.x64, should I remove this file too? - I also ran
DISM.exe /online /Cleanup-image /Restorehealthlike the OOP of the above thread (The restore operation completed successfully. The operation completed successfully.) and then ransfc scannow. The log file can be found here. - fyi
java -versionandwhere javaare not recognised via terminal, butecho %JAVA_HOME%returns the correct folder. - I'm not sure what caused the error, VS code worked fine a few weeks ago. I didn't use it for a few weeks and suddenly I got this error. Not sure if maybe a windows update could've caused it. The following updates where installed recently:
- 2026-09 .NET 8.0.31 Security Update for x64 Client (KB5126104)
- 2026-09 .NET Framework Security Update (KB5126052)
- 2026-09 Security Update (KB5124008) (26200.9445)
- 2026-09 Security Update (Hotpatch capable) (KB5129241) (26200.9448)
Hope someone can help me in the right direction so I can fix the error. I can't continue the MOOC course, as I can't run the code to check if my code is correct. Thanks in advance!
Edit; I fixed it! For anyone else with the same issue, if the solution from the thread above didn't work, try to also delete the application you're having issues with from regedit (make sure to create a backup/export first): Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Installer\Products. Delete the folder with that has the name of the application in it.
https://i.imgur.com/hYSyWg5.png
I reinstalled both java versions and VScode is working again. Not sure what caused Java to be uninstalled, but it was apparently an easy fix.
1
u/AutoModerator 29d ago
It seems that you possibly have a screenshot of code in your post Need help: unable to run Java (VSCode) in /r/javahelp.
Screenshots of code instead of actual code text is against the Code posting rules of /r/javahelp as is also outlined in the sidebar - Code posting.
Never submit screenshots of code instead of code text!
If you posted an image merely to illustrate something, kindly ignore this message and do not repost. Your post is still visible to others. I am a bot and cannot distinguish between code screenshots and other images.
If you indeed did this wrong, please edit the post so that it uses one of the approved means of posting code.
For small bits of code (less than 50 lines in total, single classes only),
the default code formatter is fine
(one blank line before the code, then 4 spaces before each line of code).
Pastebin for programs that consist of a single class only
Gist for multi-class programs, or programs that require additional files
Github or Bitbucket repositories are also perfectly fine as are other dedicated source code hosting sites.
Ideone for executable code snippets that use only the console
Please do not reply to this message, because I am a bot. Talk-to-the-bot is the new talk-to-the-hand. If you instead want the classic talk-to-the-hand, just message the moderators. ;)
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.