Search code examples
javapathjavacjava-home

Java: System cannot find the file C:\ ... java.exe


I have installed Java 8 and set my JAVA_HOME and JRE_HOME paths and added %JAVA_HOME% to the start of the path variable.

I created a helloworld.java application and am able to compile it using:

javac helloworld.java

However, when I try to run:

java helloworld

I get the error:

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

How can I solve this?


Solution

  • Just set %JAVA_HOME%/bin to your path variable.