0

I tried to update my Java version from 1.8 to 11 ON WINDOWS 10 to work with Android Studio and Flutter. I configured the JAVA_HOME environment variable to point to JDK 11 and removed any references to Java 1.8 from the PATH. However, when I run java -version, I still get an error related to version 1.8. How can I resolve this issue and make sure my environment is using the correct Java version?

I configured the JAVA_HOME environment variable to point to JDK 11 and removed any references to Java 1.8 from the PATH and from the computer too (deleted all versions except the 11th)

When I tried javac -version it prints the right version (javac 11.0.16.1) But when I execute java -version it shows this message

Error: could not open `C:\Program Files\Java\jre1.8.0_251\lib\amd64\jvm.cfg'

Can anyone help please ?

Abra
  • 19,142
  • 7
  • 29
  • 41
  • 2
    Did you restart your terminal after changing the path? – Valerij Dobler Aug 29 '23 at 21:27
  • Do you have "where.exe" installed? What does "where java" say? See https://stackoverflow.com/questions/304319 – Stephen C Aug 30 '23 at 06:35
  • Make sure you change the PATH variable correctly. See the following guide from https://www.java.com/en/download/help/path.html – jonas Aug 30 '23 at 07:40
  • There is a contradiction in *When I tried javac -version it prints the right version (javac 11.0.16.1) But when I execute java -version it shows this message (something else)*. What are the command that make the difference? – Jean-Baptiste Yunès Aug 30 '23 at 08:00

1 Answers1

0

Well, it's fixed, I just deleted and reinstalled my jdk