Java/javac

Advertisement


Question
Hi There. Im currently teaching myself java from different tutorils on the internet. verytime I try compiling any programs in the command promt, I get an error saying "javac is not recognised as an internal or external command, operable program or batch file." what could the problem be here. I tried reinstalling the JDK, but I sill get the same error.am I perhaps using the wrong JDK, if so, what would you suggest?

Thank you very much for your help

Answer
when you install the Java SDK it does not add the compiler to the PATH, only things on the PATH and the current directory can be directly executed. The javac executable is located in program files\JDK<version>\bin folder. You either need to type in that full path, change your current directory to that path, or add the bin directory to your PATH (Computer -> properties -> advanced -> enviromental settings, then edit PATH adding a ; and the path to your java install).

You can also simply download an IDE such as Eclipse or Netbeans and it will handle the compiling itself.

Java

All Answers


Answers by Expert:


Ask Experts

Volunteer


Artemus Harper

Expertise

I have a Masters in computer science. I can answer questions on core J2SE, swing and graphics. Please no questions about JSP or J2ME.

Experience

I have experience in Core Java, good background in Java swing/gui, some experience with JNI, Java reflection. Some experience in bio-informatics. Basics in c++ and c#

Organizations
Washington State University

Education/Credentials
MS in Computer Science from Washington State University and a BS in Mathematics and Computer Science from Central Washington University.

©2012 About.com, a part of The New York Times Company. All rights reserved.