简体   繁体   English

我正在尝试将我的JAVA_HOME路径设置为使用我的javac.exe吗?

[英]I'm trying to set my JAVA_HOME path to use my javac.exe?

I'm on Windows 7 and I'm trying to set my JAVA_HOME path to use PhoneGap on android, when i create a project using the command line "cmd" it tells me that it can't find javac.exe? 我在Windows 7上,试图将我的JAVA_HOME路径设置为在Android上使用PhoneGap,当我使用命令行“ cmd”创建项目时,它告诉我找不到javac.exe吗? although i'm sure that I've set the variable right 尽管我确定我已经正确设置了变量

here's my stuff: 这是我的东西:

Variable name: JAVA_HOME
Variable value: C:\Progra~1\Java\jdk1.7.0_17\bin
(I've also tried to use: C:\Progra~1\Java\jdk1.7.0_17\bin\javac.exe)

My javac.exe location on my laptop C:\\Program Files\\Java\\jdk1.7.0_17\\bin\\javac.exe 我在笔记本电脑C:\\Program Files\\Java\\jdk1.7.0_17\\bin\\javac.exe

and it still tells me that it can't locate the javac.exe 而且它仍然告诉我找不到javac.exe

What I type to create the project and i meet this problem is this: 我键入以创建项目并遇到此问题的内容是:

C:\Users\user>cd C:\Users\user\Desktop\phonegap-2.8.1\lib\android\bin

C:\Users\user\Desktop\phonegap-2.8.1\lib\android\bin>create.bat
Cannot locate javac.exe using the PATH environment variable.
Retry after adding directory containing javac.exe to the PATH variable.
Remember to open a new command window after updating the PATH variable.
Visit http://java.oracle.com if you need to install Java (JDK).

Also, i've tries restarting the windows and closing the command prompt and redownloading the JDK. 另外,我尝试重新启动Windows并关闭命令提示符,然后重新下载JDK。

Thank You. 谢谢。

cmd is using the values from the PATH variable to locate javac : cmd使用PATH变量中的值来定位javac

set "PATH=%PATH%;C:\Program Files\Java\jdk1.7.0_17\bin"

For other softwares (Tomcat, Maven, etc.) JAVA_HOME must indicate the root of your JDK : 对于其他软件(Tomcat,Maven等), JAVA_HOME必须指示您的JDK的根目录:

set "JAVA_HOME=C:\Program Files\Java\jdk1.7.0_17\"

No need to restart Windows. 无需重新启动Windows。 When using set the changes are taken immediately. 使用set ,将立即进行更改。

If you choose to modify those variables in the Control Panel, you have to close and relaunch cmd for the changes to take effect. 如果选择在“控制面板”中修改这些变量,则必须关闭并重新启动cmd才能使更改生效。

You have to add java 您必须添加java

C:\Program Files\Java\jdk1.7.0_17\bin

Note that your path may be different. 请注意,您的路径可能不同。

to your environment variables and restart your console. 到您的环境变量,然后重新启动控制台。

You can find how to set your variables here: http://www.itechtalk.com/thread3595.html 您可以在此处找到如何设置变量的方法: http : //www.itechtalk.com/thread3595.html

Set the JAVA_HOME Variable 设置JAVA_HOME变量

Right-click the My Computer icon on your desktop and select Properties.
Click the Advanced system settings. Click the
Environment Variables button. Under System Variables, click New.
Enter the variable name as JAVA_HOME.
Enter the variable value as the installation path for the Java Development Kit(C:\Program Files\Java\jdk1.7.0_17).
Click OK.
Click Apply Changes.

You might need to restart windows. 您可能需要重新启动Windows。

Set the JAVA_HOME environmental variable to JAVA_HOME环境变量设置为

C:\Program Files\Java\jdk1.7.0_17

Press

Win + Break > Advanced System Settings > Environment Variables > System Variables

Modify/set JAVA_HOME to the above. JAVA_HOME修改/设置为上述内容。 (No need to restart) (无需重启)

I already had this error when I tried to create a new phonegap project for android but unfortunately I don't remember how exactly I have fixed this. 当我尝试为android创建一个新的phonegap项目时,我已经遇到了这个错误,但是不幸的是,我不记得我是如何解决这个问题的。

I don't know if you have followed the phonegap documentation so here is the link : new project , especially the part 3B (be careful about ; in your PATH ). 我不知道您是否遵循了phonegap文档,因此这里是链接: 新项目 ,尤其是3B部分(请注意;PATH )。 If you don't know what to do now, maybe you should do it again step by step. 如果您现在不知道该怎么办,也许您应该一步一步地做。

May be a little old, but since this is the first goolge result, I might as well add a little something. 可能有些旧,但是由于这是第一个goolge结果,因此我不妨添加一些内容。

You need to create the JAVA_HOME variable AND edit the PATH variable, adding ;%JAVA_HOME%\\bin (with a ;) so cmd and some other apps can actually use javac and the rest of the tools 您需要创建JAVA_HOME变量并编辑PATH变量,并添加;%JAVA_HOME%\\bin (带有;),以便cmd和其他一些应用程序可以实际使用javac和其余工具

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

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