简体   繁体   English

Java:系统找不到文件 C:\\ ... java.exe

[英]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.我已经安装了 Java 8 并设置了我的JAVA_HOMEJRE_HOME路径,并将%JAVA_HOME%添加到path变量的开头。

I created a helloworld.java application and am able to compile it using:我创建了一个 helloworld.java 应用程序并且能够使用以下方法编译它:

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?我该如何解决这个问题?

1.Just go to C:\\ProgramData\\Oracle\\Java\\javapath\\ 1.只需转到 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 2.你会发现有java.exe、javaw.exe、javaws.exe的快捷方式,它们指向一个现在实际上不存在的位置

3.Go to the jre location where you have installed java like C:\\Program Files\\Java\\jre6\\bin 3.转到安装java的jre位置,如C:\\Program Files\\Java\\jre6\\bin

  1. You will find java.exe,javaw.exe,javaws.exe你会发现 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.为这些文件创建快捷方式并替换为 C:\\ProgramData\\Oracle\\Java\\javapath 中存在的快捷方式。

It works有用

只需将 %JAVA_HOME% /bin 设置为您的路径变量。

If you are blocked from modifying system variables from command line, but are able to open up an elevated command prompt, then run a command like this:如果您无法从命令行修改系统变量,但可以打开提升的命令提示符,请运行如下命令:

setx \\M JAVA_HOME "C:\\Program Files\\Java\\jdk1.8.0_25"

But of course, change the directory to point to your installed version of java.但是当然,将目录更改为指向您安装的 java 版本。 Note that the JAVA_HOME path does not point into the bin directory, it stops one level above bin.请注意,JAVA_HOME 路径并未指向 bin 目录,它在 bin 上一级停止。

I was able to solve this issue.我能够解决这个问题。 To do so I used the advice from this answer :为此,我使用了这个答案中的建议:

Java SE Development Kit 8u25 on a 64-bit Windows 8 64 位 Windows 8 上的 Java SE 开发工具包 8u25

Set the following user environment variables (== environment variables of type user variables)设置以下用户环境变量(==用户变量类型的环境变量)

•JAVA_HOME : C:\Program Files\Java\jdk1.8.0_25
•JDK_HOME  : %JAVA_HOME%
•JRE_HOME  : %JAVA_HOME%\jre
•CLASSPATH : .;%JAVA_HOME%\lib;%JAVA_HOME%\jre\lib
•PATH      : your-unique-entries;%JAVA_HOME%\bin 

(make sure that the longish your-unique-entries does not contain any other references to another Java installation folder.) (确保较长的 your-unique-entries 不包含对另一个 Java 安装文件夹的任何其他引用。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 系统找不到文件 C:\\ProgramData\\Oracle\\Java\\javapath\\java.exe - The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe “系统找不到文件 C:\ProgramData\Oracle\Java\javapath\java.exe” - "The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe" 找不到路径:系统找不到文件 C:\\ProgramData\\Oracle\\Java\\javapath\\java.exe - Path not Found: The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe 无法运行:系统找不到文件C:\ProgramData\Oracle\Java\javapath\java.exe - Can't run: The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe 找不到java.exe - Cannot find java.exe 从通过VBA启动的.bat文件运行时找不到java.exe - Cannot find java.exe when run from a .bat file launched via VBA 无法关闭 java.exe,JNI 调用 - Cannot close java.exe, JNI calls 将java.exe -cp someclass输出到文件 - output java.exe -cp someclass to a file iReport在Ubuntu中搜索java.exe文件 - iReport is searching for java.exe file in Ubuntu 提供的 javaHome 似乎无效。 我找不到 java 可执行文件。 试过位置:C:\Program Files\Java\jdk-17\bin\java.exe - The supplied javaHome seems to be invalid. I cannot find the java executable. Tried location: C:\Program Files\Java\jdk-17\bin\java.exe
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM