java %JAVA_HOME%\bin 不适用于 Windows 8.1 for javac
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28259604/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
%JAVA_HOME%\bin not working on Windows 8.1 for javac
提问by BabarBaig
There are a lot of posts about JAVA_HOME
, but I couldn't find an answer for this:
有很多关于 的帖子JAVA_HOME
,但我找不到答案:
- On Windows 8.1 command prompt, I was not able to run javac, getting
the error:
'javac' is not recognized as an internal or external command, operable program or batch file.
javac is located at: C:\Program Files\Java\jdk1.8.0_11\bin
. And,JAVA_HOME=C:\Program Files\Java\jdk1.8.0_11
. Based on many suggestions here, I added toPATH=....;%JAVA_HOME%\bin;
Unfortunately, system gave the same error message with javac.- So I removed
JAVA_HOME
fromPATH
and replaced it with the fully qualified path. Problem solved! - My question: Does anyone know why the more elegant solution didn't work?
- 在 Windows 8.1 命令提示符下,我无法运行 javac,出现错误:
'javac' is not recognized as an internal or external command, operable program or batch file.
javac is located at: C:\Program Files\Java\jdk1.8.0_11\bin
. 和,JAVA_HOME=C:\Program Files\Java\jdk1.8.0_11
. 根据这里的许多建议,我添加了PATH=....;%JAVA_HOME%\bin;
不幸的是,系统给出了与 javac 相同的错误消息。- 所以我删除了
JAVA_HOME
从PATH
与完全合格的路径来替换它。问题解决了! - 我的问题:有谁知道为什么更优雅的解决方案不起作用?
Thanks in advance.
提前致谢。
回答by Sigi Huber
I cannot comment yet, so I will give an answer instead.
我还不能发表评论,所以我会给出一个答案。
I once had a similar problem on a Windows 7 system: Environment variables in my PATH (which is itself an environment variable) were no longer expanded. I found out that somehow the type of registry key that represents the PATH had changed from REG_EXPAND_SZ to REG_SZ.
我曾经在 Windows 7 系统上遇到过类似的问题:我的 PATH 中的环境变量(它本身就是一个环境变量)不再被扩展。我发现以某种方式表示 PATH 的注册表项类型已从 REG_ EXPAND_SZ更改为 REG_SZ。
The registry key is
注册表项是
HKEY_LM\SYSTEM\CurrentControlSet\Control\SessionManager\Environment\Path
Actually you cannot change the type, instead you rename the original PATH entry, create a new one with the correct type ie REG_EXPAND_SZ and copy the value.
实际上,您无法更改类型,而是重命名原始 PATH 条目,使用正确类型创建一个新条目,即 REG_EXPAND_SZ 并复制该值。
I can't remember the website which helped me back then, but this Serverfault Environment variable...describes the situation.
我不记得当时帮助我的网站,但是这个Serverfault Environment 变量......描述了这种情况。
回答by Skitty
1.Type jdk8(Java Development Kit) on your browser and click the first link(Java SE Development Kit 8 - Downloads - Oracle or Click this link.
1.在浏览器上输入 jdk8(Java Development Kit) 并点击第一个链接(Java SE Development Kit 8 - Downloads - Oracle or Click this link。
- Accept the License Agreement and select your windows version . Then click the link to download the jdk8.
- 接受许可协议并选择您的 Windows 版本。然后点击链接下载jdk8。
3.Then click the icon to install the jdk.
3.然后点击图标安装jdk。
4.Click Next
4.点击下一步
5.Go to your C drive => program Files => java => jdk1.8.0_05 => bin
5.转到你的C盘=>程序文件=> java => jdk1.8.0_05 => bin
6.When you inside bin right click appletviewer and go to properties
6.当你在bin中右键单击appletviewer并转到属性
7.Copy the location : C:\Program Files\Java\jdk1.8.0_05\bin
7.复制位置:C:\Program Files\Java\jdk1.8.0_05\bin
8.Click My computer => properties => Advanced system settings => Environment Variables
8.点击我的电脑=>属性=>高级系统设置=>环境变量
9.Under the system variables Find Path and click Edit.
9.在系统变量下查找路径并单击编辑。
- Go to the end of the Variable value and add a semicolon ; and paste (C:\Program Files\Java\jdk1.8.0_05\bin) Click Ok.
- 转到变量值的末尾并添加分号;并粘贴 (C:\Program Files\Java\jdk1.8.0_05\bin) 单击确定。
- Open the command prompt (CMD) and type javac
- 打开命令提示符 (CMD) 并键入 javac
Congratulation you have successfully install JDK8
恭喜你成功安装JDK8