I've installed the sdk and everything, and when i try to compile my hello world program from sun (javac HelloWorldApp.java) it says
'JAVAC' is not recognized as an internal or external command, operable program or batch file.
:confused:
Printable View
I've installed the sdk and everything, and when i try to compile my hello world program from sun (javac HelloWorldApp.java) it says
'JAVAC' is not recognized as an internal or external command, operable program or batch file.
:confused:
What are you compiling from? javac HelloWorldApp.java would be the proper syntax for compiling your .java file HelloWorldApp
My command line would look like this. C:\jdk1.3\bin> javac C:\Java\HelloWorldApp.java
You got to have the bin folder in you CLASSPATH for that to work. Do you understand what I'm saying? If not, I'll post you an example. Later, Jeremy
yeah not really sure...if you could post that example that would be great :confused:
It really all depends on the operating system you are using but here goes. For you to use any of the java tools from the command line from anywhere in your system, you have to have the Java SDK bin folder in your CLASSPATH. Here is what you need to do:
1) Right-click "My Computer" and select Properties
2) Click the "Advanced" tab.
3) Click "Environment Variables" button.
4) Look for a variable called "CLASSPATH" and if it's there, double-click it and add the physical path to the bin folder in your Java SDK Folder (Ex: "C:\Java2SEDK\bin;");
5) If it's not there, click new and give it a name of "CLASSPATH" and then put the path, like in step 4, in the Value.
If you need more help, let me know. Also...you can use an IDE to do most of this for you. I use NetBeans and you can compile and run your programs in the IDE without having to go to the command line. Best of all, it's free and one of the best Java IDEs available. Even Sun's IDE is based on NetBeans. Here is a link:
NetBeans
HTH, Jeremy
I don't think that it is necessary to have the bin folder set in the CLASSPATH under the autoexec.bat. I think all you need is it to set the directory when your .class files are located in the CLASSPATH.
still doesn't recognize javac as a command :( i've got it working on netbeans, wonder why not here
CLASSPATH if very important here. Will you email me your CLASSPATH? Also...do you have your JAVA_HOME set? Later, Jeremy
P.S. - [email protected]
Neither CLASSPATH nor JAVA_HOME are of interest here, what is important is PATH.
PATH must include the bin subdirectory of your SDK installation.
CornedBee is correct once again. I though that if you put the bin in you CLASSPATH that would help you if you didn't put it in your PATH no?
CLASSPATH only has a meaning for the Java Virtual Machine, it's where the class loader searches for .class files.
Exactly. That was what i was trying to get at.Quote:
Posted by CornedBee
Neither CLASSPATH nor JAVA_HOME are of interest here, what is important is PATH.
PATH must include the bin subdirectory of your SDK installation.
I was wrong all. Please forgive my lack of judgement before posting, ;)
A while back i could type in set path = C:\jdk1.3\bin at the DOS prompt which would enable me to run the compiler outside of the \bin directory. For some reason i can't get it to work. :(
Here is a good link on how to set PATH from the Command Line
PATH
HTH, Jeremy