Search code examples
javawindowswindows-8

Java path set wrongly


I have installed Java on a new system. Some random path in my C drive is automatically set for my PATH variable. Whenever I try to run Java, it shows java.exe not found in that wrong path!

I'm trying to change the PATH variable using the SET command, but the new path is only getting added along with the old one. I could not run Java on the system.

set PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_71\bin 

I've tried setting PATH variable in Windows Environment Variables list also after setting JAVA_HOME!

When I type Java in cmd, i get:

The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe.

This path is the old unknown automatically set path.

Is there any way to run Java! I'm using windows 8.


Solution

  • if you are using windows system, please create java_home as a variable and set java home path i.e. till C:\Program Files\Java\jdk1.7.0_71, and in path variable do not delete existing just append new with ;%java_home%\bin

    this will work

    in you case SET is valid till command prompt is open. do the above changes in my computer -> properties -> advanced ->environment variables