简体   繁体   English

Java不会编译

[英]Java won't compile

I have been getting an error when I try to compile my Java code. 尝试编译Java代码时出现错误。 'javac' is not recognized as an internal or external command, operable program or batch file.

My directory looks like this: Computer -> OS(C:) -> Program Files -> Java -> jdk1.8.0_60 -> Bin 我的目录如下所示: Computer -> OS(C:) -> Program Files -> Java -> jdk1.8.0_60 -> Bin

When I type set path into CMD I get this: Path=file:///C:/Program%20Files/Java/jdk1.8.0_60/bin 当我在CMD中键入set path我得到以下信息: Path=file:///C:/Program%20Files/Java/jdk1.8.0_60/bin

My question is: Why isn't javac being recognized even after I have changed the path? 我的问题是:为什么即使更改路径也无法识别javac

C:\\Program Files (x86)\\Java\\jdk1.8.0_11\\bin;

在此处输入图片说明 在此处输入图片说明

Note that your java is in Program Files (x86) not Program Files . 请注意,您的Java位于Program Files (x86)而不位于Program Files

You should set path like this, 您应该这样设置路径,

set path=C:\Program Files (x86)\Java\jdk1.8.0_11\bin
echo %path%

Moreover it will not set the path forever once you close the cmd the path you has set will just vanish . 而且,一旦关闭cmd,设置的路径就不会消失,它不会永远设置路径。 If you want to store the path in your system you should add your path to system 's environment variable. 如果要将路径存储在系统中,则应将路径添加到system的环境变量中。 You may find this helpful for adding environment variable. 您可能会发现对于添加环境变量很有帮助。

First of all check whether your system is 64-bit or 32-bit windows. 首先检查您的系统是64-bit还是32-bit Windows。 If it is 32-bit you are doing fine but if it is 64-bit you need to download 64-bit version of jdk and when you install it the java bin should be available in program files not in program files(x86) then set the path from there. 如果它是32-bit ,则表示性能很好,但如果是64位,则需要下载64位版本的jdk,并且在安装它时,java bin应该在程序文件中可用,而不是在程序文件(x86)中,然后设置从那里的路径。

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

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