我家里刚买了一台新电脑。我整晚都在尝试在我的 Windows 7 64 位机器上安装 JDK 8u11。我知道我下载了正确的 64 位版本。我知道我的计算机上已经安装了 JRE,因为 java -version
在 cmd 中返回 java version "1.8.0_11"
。我可以在“添加/删除程序”列表中看到 JRE 和 JDK。但是,我的 IDE 无法识别已安装 JDK,当我在 cmd 中键入 javac
时,我得到 'javac' is not recognized as an internal or external command, operable program, or batch file.
这让我相信 JDK 并没有真正安装,但我已经尝试重新安装并重新启动几次,就像我之前说的,它出现在添加/删除程序中。我还可以在\Program Files\Java 中看到\jdk1.8.0_11 文件系统,就在\jre8 文件夹旁边。\jdk1.8.0_11 文件系统看起来很完整,当然除了实际的应用程序 jdk-8u11.exe(或类似文件)。那是无处可寻的。
有人知道问题出在哪里吗?
注意:JAVA_HOME
不是环境变量。我尝试手动创建环境变量,但以下路径不起作用:
C:\Program Files\Java\jdk1.8.0_11
C:\Program Files\Java\jdk1.8.0_11\bin
C:\Program Files\Java\jdk1.8.0_11\java.exe
最佳答案
Windows 7:
From the desktop, right click the Computer icon.
Choose Properties from the context menu.
Click the Advanced system settings link.
Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable. Click OK. Close all remaining windows by clicking OK. Note: You may see a PATH environment variable similar to the following when editing it from the Control Panel:
%JAVA_HOME%\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
关于java - JDK 似乎已安装,但未被检测到并且命令不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25320625/