Skip to content

How do I make the command java -version work on my computer with Windows 8.1?

Problem
I’ve installed Java 9 on my computer with Windows 8.1, followed instructions on the Internet to configure system variables and the commands java -version and javac -version worked on Command Prompt.

Then I had to change to Java 10, so I installed, changed the system variables, but now only javac -version works, when I try to use java -version I get errors.

Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

I need Java working so I can follow some online classes, I don’t want to get stuck because there is something wrong with my installation.

Information about my Java installation
I’ve used the jdk-10.0.2_windows-x64_bin.exe installer I’ve got from Oracle’s website. I’ve got the folders jdk-10.0.2 and jre-10.0.2 on C:Program FilesJava after running the installer.

My system variables configurations
My user’s PATH variable: C:UsersIvanAppDataLocalProgramsPythonPython37Scripts;C:UsersIvanAppDataLocalProgramsPythonPython37;C:UsersIvanAppDataLocalGitHubDesktopbin;%JAVA_HOME%bin

My JAVA_HOME system variable:
C:Program FilesJavajdk-10.0.2

My Path system variable:
C:ProgramDataOracleJavajavapath;c:Program Files (x86)InteliCLS Client;c:Program FilesInteliCLS Client;%SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;%SYSTEMROOT%System32WindowsPowerShellv1.0;C:Program FilesIntelIntel(R) Management Engine ComponentsDAL;C:Program FilesIntelIntel(R) Management Engine ComponentsIPT;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsDAL;C:Program Files (x86)IntelIntel(R) Management Engine ComponentsIPT;c:Program Files (x86)ATI TechnologiesATI.ACECore-Static;C:Program Files (x86)Windows LiveShared;C:Program Files (x86)PuTTY;C:Program FilesMiKTeX 2.9miktexbinx64;C:Program FilesMicrosoft VS Codebin;C:Program FilesGitcmd;C:Program FilesGitmingw64bin;C:Program FilesGitusrbin;

Answer

As alluded to by @user15358848 the oracle installer does this weird thing where it creates a link to the jdk in addition to messing with the path. You can see it added to your path C:ProgramDataOracleJavajavapath; It most likely it broken after the installation steps you have taken up to this point. If you want to use the JAVA_HOME variable then remove the oracle entry and add %JAVA_HOME% to your path. You will need to restart the console and or application to pick up the new path variable.