Greetings,
I installed the J2 SDK and am following the tutorial for newbies (hello world). When attempting to execute in the DOS window I get the message,
"javac is not recognized as an internal or external command, operable or batch command". I have attempted to follow the instructions for setting the path. It was a bit vague for XP but I went through the control panel to system and found the environment variable button under 'Advanced' tab. What I added was the variable name 'javac' and the path, including the file name (c:\j2sdk\bin\javac.exe). Is this the correct format?
I can see the HelloWorldApp.java file. It appears correct. From within that directory I can type c:\j2sdk\bin\javac.exe HelloWorldApp.java and I do not get the error message but also do not get Hello World or anything else. It skips a line and returns the prompt. If I create an error in the HelloWorldApp.java file, I do get a compiler error message (syntax). Just to make sure, here is a copy/paste of the file:
class HelloWorldApp
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
Miscellaneous 'stuff' which may or may not be important: I checked and have the latest MS Service Pack. I did change the name of the install directory from j2sdk1.4.2_05 to j2sdk. I do see javac.exe under the bin directory. I do not see any process which appears to be a Java-related running under tasks or applications in task manager.
Re: Error: javac is not recognized as ...command
Jul 22, 2006 1:42 PM
(reply 10
of 13) (In reply to
#9 )
Go to C:\j2sdk1.4.2_12. In this Dir in README.htm you have instructions to set the path variables. You need to add a new environment variable named as PATH with value C:\J2SDK1.4.2_<version>\BIN
Okay the Javac error is an old problem and should not be so hard to fix. This knowledgge should be spread far and wide. It comes from the set classpath issue.
This solution works only if you have downloaded the entire jdk-6u12-windows-i586-p download
THe problem is that you need to add a path to the path in your environment settings.
First gop to the Bin filwe in your java folder. You will see a path in y our address line. Copy this address.
Go to "My Computer" and select Properties. Frome there select advanced. Then go to the second lowser pane and select "Path" Choose edit,. Have a care hertre. The path ends with a / or a \ place a semicolon at the end of the statement. Copy into this line the address you copied. Then paste a semicolon to the end. Then look at the whole path and Make siure there are only the original and the new added with the new adddress ending with a semicolon.