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

后端 未结 19 1165
温柔的废话
温柔的废话 2020-12-02 22:39

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

相关标签:
19条回答
  • 2020-12-02 23:06

    For New version of Java JavaPath folder is located

    64 bit OS

    "C:\Program Files \Common Files\Oracle\Java\javapath\"

    X86

    "C:\Program Files(x86) \Common Files\Oracle\Java\javapath\"

    0 讨论(0)
  • 2020-12-02 23:07

    c:\ProgramData\Java\javapath is used for symlinks. You can of course add the full path to your Java Path to %PATH%, but equally you can create a symlink to the path to the above location.

    1. Open CMD as Administrator.
    2. Type mklink java.exe (full path to your Java.exe) eg

    mklink java.exe "C:\Program Files\Java\jdk1.8.0_25\bin\java.exe"

    0 讨论(0)
  • 2020-12-02 23:08

    I had in PATH:

    C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.8.0_92\bin;<others omitted>
    

    I removed:

    C:\ProgramData\Oracle\Java\javapath;
    

    and that fixed the issue for me. java -version now gives details about the Java version, etc.

    0 讨论(0)
  • 2020-12-02 23:13

    I've got a similar problem I'm currently working on solving. I can't say this will solve your error since there may be issues with other software (which is my case with Eclipse Luna).

    Java is using the path given in your PATH variable, which is,

      C:\ProgramData\Oracle\Java\javapath
    

    Go to this folder (ProgramData is hidden, so unhide it if necessary) and right click on the java.exe symlink. You'll see in the Target field where it's looking for java.exe. It may be pointing to the java.exe file from your previous jdk1.6.0_45 install. Either paste in new shortcuts here or change the PATH setting as others have mentioned.

    I've found that the Java installer doesn't change the javapath or update the system path, at least when going from 1.8 to 1.7. In my case changing the shortcuts only led to a problem with Eclipse on startup.

    EDIT:----- After playing with javapath folder shortcuts it turns out you need symlinks, at least for Eclipse. See, Windows how to create directory symlink.

    You don't need the /d switch for a file symlink,

      mklink java.exe "C:\Program Files\Java\jdk1.8.0_20\bin\java.exe"
      mklink javaw.exe "C:\Program Files\Java\jdk1.8.0_20\bin\javaw.exe"
      mklink javaws.exe "C:\Program Files\Java\jdk1.8.0_20\bin\javaws.exe"
    

    This now works for me.

    0 讨论(0)
  • 2020-12-02 23:13

    This usually happens when you update the java, the easiest way to solve this is to just uninstall the JDK & then reinstall it. NOTE: This doesnt remove the path or classpath so no need to worry.

    0 讨论(0)
  • 2020-12-02 23:13

    I had also similar problem where by I had to un-install JDK 1.8 and needed jdk 1.7. What i did was removed the symbolic links from the javapath and then imported the shortcuts of java, javaw, javaws from the bin directory to the javapath folder. However, I found some permission issues in the enterprise laptop where by I did not have the privilege to modify/ update this directory. I had given appropriate permission from the administrator and there by resolved it.

    0 讨论(0)
提交回复
热议问题