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

24,841

Solution 1

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

Solution 2

1.Just go to C:\ProgramData\Oracle\Java\javapath\

2.You will find there shortcuts for java.exe,javaw.exe,javaws.exe which are pointing to a location where they actually are not existing now

3.Go to the jre location where you have installed java like C:\Program Files\Java\jre6\bin

  1. You will find java.exe,javaw.exe,javaws.exe

  2. Create shortcuts for these files and replace with the ones which are present in C:\ProgramData\Oracle\Java\javapath.

It works

Share:
24,841
rni902
Author by

rni902

Updated on December 09, 2020

Comments

  • rni902
    rni902 over 3 years

    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?