简体   繁体   中英

Java won't compile

I have been getting an error when I try to compile my Java code. '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

When I type set path into CMD I get this: Path=file:///C:/Program%20Files/Java/jdk1.8.0_60/bin

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 .

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 . If you want to store the path in your system you should add your path to system 's environment variable. You may find this helpful for adding environment variable.

First of all check whether your system is 64-bit or 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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