I am on JDK 8u25 on Windows 8, and I am experiencing a problem with my Java installation. I can run javac
perfectly fine, but running java
produc
There are 2 versions of jdk in your PATH VARIABLE
jdk1.6.0_45
and jdk1.8.0_25
. Try removing the first one ie. jdk1.6.0_45
from the PATH
Don't worry. Just uninstall jdk as well as jdk updates Before re installing jdk ,delete the oracle folder inside programData hidden folder in C:\ Then reinstall. Set the following,
JAVA_HOME
CLASSPATH
PATH
JRE_HOME ( is optional)
C:\ProgramData\Oracle\Java
and delete that directory and all files contained within. You can do this from the command line using rmdir /S C:\ProgramData\Oracle\Java
rmdir /S C:\ProgramData\Oracle
Now install JDK and set the path.
Run the program.You won't find the same problem anymore.
This problem exists when you upgrade from one version to another.because jdk is not automatically upgraded.
For the same you can change the environmental varibles. In system variables look for the PATH and add the jdk bin location in the front of the string(not at the back). Once you have done that check in CMD if "java" and "javac" works. if it works, again go to system variables. add "CLASSPATH" A the variable and set value " . c:\Program Files\Java\jdk1.8.0_91\lib;"
I got same error while running JAVA command. To resolve this, I moved the java path as the first entry in the path, and it resolved the issue. Please have look at this screenshot for reference:
If you're on a corporate PC that's fairly restricted by group policy, this might work....
Assuming that
PATH
includes C:\ProgramData\Oracle\Java\javapath
C:\Program Files\Java\jdk1.8.0_60\bin
Then create the following text file mklink.bat
and put it on your desktop:
rem mklink.bat
mklink /d C:\ProgramData\Oracle\Java\javapath "C:\Program Files\Java\jdk1.8.0_60\bin"
pause
Now right-click it and choose "Run as Administrator". Provide admin credentials. The script should report success. Now you can compile or run Java.