简体   繁体   中英

Java is recognized but Javac is not recognized

I recently installed Java but when I open the command line and I enter:

java -version

I get back:

C:\Users\Tim>java -version
java version "1.8.0_60"
Java(TM) SE Runtime Environment (build 1.8.0_60-b27)
Java HotSpot(TM) 64-Bit Server VM (build 25.60-b23, mixed mode)

But when I enter:

javac -version

I get back:

C:\Users\Tim>javac -version
'javac' is not recognized as an internal or external command,
operable program or batch file.

I added the following line to the end of my path in environment variables:

;C:\Program Files\Java\jdk1.8.0_60\bin;

I installed this version:

jdk-8u60-windows-x64.exe

I use Windows 10. I have sought out multiple sources for help but none of them seem to be working. I think I've installed the right package as the name is JDK, it is for Windows on a 64 machine and java is found, but the compiler is not. I'm trying to train on Java now, but I'm stuck here and can't go much further until I iron this out. I appreciate any help. Thank you.

You missed some steps. Go to variable environment and do the following:

System Variables:

  • Edit path variable adding the following:

    ;C:\\ProgramFiles\\Java\\Java_version\\bin

  • Create a new variable. Its name will be classpath and its value will be: ;C\\ProgramFiles\\Java\\Java_Version\\src.zip

User Variables :

  • Create a variable called path , its value will be: C:\\ProgramFiles\\Java\\Java_verson\\bin

  • Create a variable called classpath , its value will be: C\\ProgramFiles\\Java\\Java_Version\\src.zip

I had that problem.. the solution is to remove all spaces from the java path. So instead of having it located at:

JAVA_HOME = C:\\Program Files\\Java\\jdk1.8.0_60

move the jdk folder to,

for example: JAVA_HOME = C:\\Java\\jdk1.8.0_60

Then add the following line to the end of path in environment variables:

C:\\Java\\jdk1.8.0_60\\bin;

it worked for me :)

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