oracle java javapath,“系统无法找到文件C:\ProgramData \Oracle \ Java \ _javapath \ javaava.exe"...

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 produces this error message:

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

How do I fix this?

I think the problem has to do with my environment variables.

The important variables, as I have set them, are:

JAVA_HOME – C:\Program Files\Java\jdk1.8.0_25

CLASSPATH – .;%JAVA_HOME%\lib

PATH – ;%JAVA_HOME%\bin

And their expansions, as viewed with set in cmd, are:

JAVA_HOME – C:\Program Files\Java\jdk1.8.0_25

CLASSPATH – .;C:\Program Files\Java\jdk1.8.0_25\lib;%CLASSPATH%;

PATH – C:\ProgramData\Oracle\Java\javapath;C:\Program Files\Java\jdk1.6.0_45\bin;;C:\Program Files\Java\jdk1.8.0_25\bin

The full output of set can be viewed here.

解决方案

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
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值