Play框架找不到javac
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18455732/
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
Play framework can't find javac
提问by rross
I'm following a play tutorial when I run the web server before making any changes to the app. The server throws an error:
在对应用程序进行任何更改之前运行 Web 服务器时,我正在学习游戏教程。服务器抛出错误:
IOException: Cannot run program "javac": CreateProcess error=2, The system cannot find the file specified
I check my JAVA_HOME and it reads C:\Program Files\Java\jdk1.7.0_25. How would one fix this issue?
我检查了我的 JAVA_HOME,它显示为 C:\Program Files\Java\jdk1.7.0_25。如何解决这个问题?
采纳答案by MadProgrammer
Make sure that the javac
is in the OS's search path
确保javac
位于操作系统的搜索路径中
For example, on Windows, goto Control Panel
-> System
, click Advanced System Settings
, click on Environment Variables
.
例如,在 Windows 上,转到Control Panel
-> System
,单击Advanced System Settings
,单击Environment Variables
。
In the System variables
, locate the variable named path
and insert C:\Program Files\Java\jdk1.7.0_25\bin
at the start of the value
. Don't forget to add ;
between the values ;)
在 中System variables
,找到命名的变量path
并插入C:\Program Files\Java\jdk1.7.0_25\bin
到 的开头value
。不要忘记;
在值之间添加;)
Click Okay
, Okay
.
单击Okay
、Okay
。
Close any command prompt windows you have open and re-open them. This will ensure that they are updated with the new environment variables.
关闭您打开的所有命令提示符窗口,然后重新打开它们。这将确保它们使用新的环境变量进行更新。
回答by victorf
Don't forget to check your system access. You should have all access power during the instalation or setting process. I just had to require full OS access (Windows, in the big company) to solve this issue and now it's all ok.
不要忘记检查您的系统访问权限。在安装或设置过程中,您应该拥有所有访问权限。我只需要完整的操作系统访问权限(大公司的 Windows)来解决这个问题,现在一切都好了。
回答by skhurana
Even though you might have the JDK bin directory in your PATH
environment variable, this problem can occur. To fix it, put the path of JDK bin directory (not the JRE one) at the beginning of the PATH variable, just in case javac
is getting picked up in the wrong directory because the wrong directory happens to be first.
即使您的PATH
环境变量中可能有 JDK bin 目录,也可能发生此问题。要修复它,请将 JDK bin 目录(不是 JRE 目录)的路径放在 PATH 变量的开头,以防万一javac
因为错误的目录恰好是第一个而被拾取到错误的目录中。
回答by maudulus
I wasn't aware that the typical java install DOES NOThave javac
. Thus, I did the following:
我不知道的是,典型的Java安装不有javac
。因此,我做了以下事情:
1) Visited the Java SE Development Kit site
1) 访问了Java SE Development Kit 站点
2) Downloaded the version for my Operating System and installed it
2) 下载适用于我的操作系统的版本并安装它
3) went to the root folder of the newly Java SE Development Kit (in this case C:\Program Files (x86)\Java\jdk1.8.0_31\bin
)
3)进入新Java SE Development Kit的根文件夹(本例中C:\Program Files (x86)\Java\jdk1.8.0_31\bin
)
4)Using the windows search, entered environment variables
, which brings up the option Edit the system environment variables
on Windows 7
4) 使用 windows 搜索,输入environment variables
,这会Edit the system environment variables
在 Windows 7 上显示该选项
5) clicked on Environment Variables
in the System Properties tab that should have opened.
5)Environment Variables
在本应打开的系统属性选项卡中单击。
6) with PATH
highlighted, clicked Edit...
6)PATH
突出显示,点击Edit...
7) Added ;
(a semi-colon to seperate this new path from the old) + C:\Program Files (x86)\Java\jdk1.8.0_31\bin
(make sure there is no space between the semi-colon and the new path.
7)添加;
(分号将新路径与旧路径分开)+ C:\Program Files (x86)\Java\jdk1.8.0_31\bin
(确保分号和新路径之间没有空格。