Maisurah Shuling
Maisurah Shuling

Reputation: 3

JAVA_HOME has been set, but java - version cannot be found in command prompt

[EDITED]

I have set my JAVA_HOME variable to "C:\Program Files\Java\jdk1.8.0_60\"

and after running javac -version on Command Prompt , i get this:

javac 1.7.0_07

However when i run java-version , i get this:

C:\Users\User\Desktop>java -version
Error: Failed reading value of registry key:
    Software\JavaSoft\Java Runtime Environment\C
Error: could not find java.dll
Error: Could not find Java SE Runtime Environment.

To clarify, i have the following files in my C:\Program Files\Java

(1) jdk1.5.0_14 (this file cannot be deleted, as its said to be in use by the system

(2) jdk1.8.0_60

(3) jre1.5.0_14

(4) jre1.8.0_60

May i know how to ensure that all jre and jdk points to the 1.8 version; and also how to get rid of the above mentioned error?

I get this upon echoing %PATH%:

C:\ProgramData\Oracle\Java\javapath;C:\Users\User\introcs\java\bin;C:\PROGRAM FI
LES\BROADCOM\BROADCOM 802.11 NETWORK ADAPTER;C:\PROGRAM FILES (X86)\NVIDIA CORPO
RATION\PHYSX\COMMON;C:\PROGRAM FILES (X86)\INTEL\ICLS CLIENT\;C:\PROGRAM FILES\I
NTEL\ICLS CLIENT\;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\WIN
DOWS\SYSTEM32\WINDOWSPOWERSHELL\V1.0\;C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT
 ENGINE COMPONENTS\DAL;C:\PROGRAM FILES\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONE
NTS\IPT;C:\PROGRAM FILES (X86)\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\DAL;C
:\PROGRAM FILES (X86)\INTEL\INTEL(R) MANAGEMENT ENGINE COMPONENTS\IPT;C:\PROGRAM
 FILES (X86)\INTEL\OPENCL SDK\2.0\BIN\X86;C:\PROGRAM FILES (X86)\INTEL\OPENCL SD
K\2.0\BIN\X64;C:\PROGRAM FILES\SONY\VAIO IMPROVEMENT;C:\PROGRAM FILES (X86)\SONY
\VAIO BIOS DATA TRANSFER UTILITY\;C:\PROGRAM FILES (X86)\SONY\VAIO STARTUP SETTI
NG TOOL;;C:\WINDOWS\SYSTEM32;C:\WINDOWS;C:\WINDOWS\SYSTEM32\WBEM;C:\WINDOWS\SYST
EM32\WINDOWSPOWERSHELL\V1.0\;C:\Program Files\WIDCOMM\Bluetooth Software\;C:\Pro
gram Files\WIDCOMM\Bluetooth Software\syswow64;C:\Program Files (x86)\Windows Ki
ts\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\110\To
ols\Binn\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\ManagementS
tudio\;c:\Program Files (x86)\Microsoft SQL Server\110\Tools\Binn\;c:\Program Fi
les (x86)\Microsoft SQL Server\110\DTS\Binn\;c:\Program Files\Microsoft SQL Serv
er\110\DTS\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Users\User\introcs\j3d\b
in;C:\Users\User\introcs\bin;C:\Users\User\introcs\java\bin;

Upvotes: 0

Views: 12918

Answers (3)

Seray Uzgur
Seray Uzgur

Reputation: 113

When you write javac on cmd promt, it is not getting it from JAVA_HOME. JAVA_HOME variable is usually for programs written in java for finding JVM easily.

What you are searching for is PATH. It promt scans the paths and binds executables than you can use them without giving absolute path.

When you write javac, it gets the javac given by PATH.

So in you case C:\ProgramData\Oracle\Java\javapath;C:\Users\User\introcs\java\bin; must be directing the wrong path, i advice delete them and give the path of the version you desired.

Upvotes: 1

jwenting
jwenting

Reputation: 5663

Also check your Windows directory (I think it's in Windows/System32) for java*.exe and delete those. They tend to override the manually installed JVM and thus any environment settings you add to your PATH for a JDK or JRE.
After that, add your %JAVA_HOME%\bin to your PATH, start a new command prompt, and you're good to go.

Upvotes: 1

Prashant Jha
Prashant Jha

Reputation: 16

set above path up to bin folder "C:\Program Files\Java\jdk1.8.0_60\bin" for jre you can set "C:\Program Files\Java\ jre1.8.0_60\bin"

Note: put above location to "PATH" system environment variables. hope this will help.

Upvotes: 0

Related Questions