0

I have following problem. I installed new OpenJDK 17:

c:\java\jdk-17.0.2

I've set up JAVA_HOME to it and added to path:

JAVA_HOME\bin

in cmd when I type java -version it works. But when I run it from VS code or powershell it says following:

Error: could not open C:\java\jdk-17.0.2\lib\jvm.cfg'

Has anybody faced similar issue?

Thanks, M.

UPDATE #1:

here are my env variable settings: env vars

path:

path

and still not working: PS powershell

Martin Fric
  • 726
  • 2
  • 9
  • 27

1 Answers1

0

Here are 5 steps you can follow to fix the issue:

  1. In the run dialog box, enter sysdm.cpl
  2. In the window that came up, navigate to Advanced tab.
  3. Click on the Environment Variables button.
  4. Add the location of your java installation (the bin directory) to the PATH variable.
;%ProgramFiles%/Java/jre%version%/bin

followed by a semi-colon ;

  1. Do the following and check again with a new PowerShell prompt

    5.1. Add a JAVA_HOME variable equal to something like: C:\Java\JDK-17.0.2

    5.2. Add %JAVA_HOME%\bin to the beginning of your PATH variable.

gagneet
  • 35,729
  • 29
  • 78
  • 113