简体   繁体   English

Windows中的JDK7问题

[英]JDK7 problems in windows

I installed JDK7 in windows. 我在Windows中安装了JDK7。 I didn't do anything more, don't confing path and classpath, this is my path enviroments: 我没有做更多的事情,没有配置路径和类路径,这是我的路径环境:

在此处输入图片说明

there can find I didn't include jdk installed directory. 可以找到我没有包括jdk的安装目录。 but when I run "java -version" command in a commandline, I saw that: 但是当我在命令行中运行“ java -version”命令时,我看到了:

在此处输入图片说明

but when i run "javac -version", it can't work, "javac" command undefined. 但是当我运行“ javac -version”时,它无法工作,“ javac”命令未定义。 If I didn't include my jdk installed directory, java and javac command must all can't work, but when in jdk7, "java" command can work, "javac" command didn't work, for solved the problem, I can include the jdk installed directory in path, but I want to know what cause the problem, is there difference between jdk7 and pre version? 如果我不包括安装的jdk目录,则java和javac命令必须都不能工作,但是在jdk7中,“ java”命令可以工作,“ javac”命令不能工作,为了解决问题,我可以在路径中包含jdk安装目录,但我想知道是什么原因造成的,jdk7和预版本之间有区别吗?

The JDK also installs a public JRE. JDK中还安装了一个公共JRE。 A public JRE adds a java.exe stub to \\windows\\system32 directory. 公用JRE将java.exe存根添加到\\windows\\system32目录。 The stub reads the registry to find out which real java.exe to execute. 存根读取注册表以找出要执行的实际 java.exe

Other JDK commands do not get the same treatment and require the JDK's bin directory to be on the system path, preferably before the \\windows\\system32 entry, for consistency. 其他JDK命令没有得到相同的处理,并且要求JDK的bin目录位于系统路径上,为了保持一致性,最好 \\windows\\system32条目之前

为了使用“ javac”之类的命令,您应该在JDK本地安装中的路径中具有\\ bin目录。

您可能在Windows \\ system32中有java.exe,但没有javac。

java.exe 也是 JRE的一部分,而javac.exe 只是 JDK的一部分

I think what has happened is that when you installed the Environment Path that was set was pointing at the JRE bin and not the JDK bin. 我认为发生的事情是,当您安装设置的环境路径时,它指向的是JRE bin,而不是JDK bin。 The JRE does not contain the javac executable. JRE不包含javac可执行文件。 Inserting the JDK bin into the Environment Path will resolve the issue as windows will now scan that folder/location to search for the executable called javac.exe 将JDK bin插入环境路径将解决此问题,因为Windows现在将扫描该文件夹/位置以搜索名为javac.exe的可执行文件

You need to add your java/bin directory to the PATH enviroment variable: 您需要将java / bin目录添加到PATH环境变量中:

something like: C:\\Program Files\\Java\\jdk1.7.0_45\\bin 类似于:C:\\ Program Files \\ Java \\ jdk1.7.0_45 \\ bin

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM