File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Javac Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Javac Question" Watch "Javac Question" New topic

Javac Question

Amri Harimi

Joined: Dec 29, 2003
Posts: 3
For some reason I cant get my machine to compile from the command line using javac I get a message that 'javac' is not recognized as an internal or external command.
I have installed VC4 Expert Edition and I downloaded Java VM and J2se 1.4.2 SDK.
How can I use javac???
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Hi Amri,
Welcome to JavaRanch!
The j2sdk1.4.2/bin directory has to be named on your PATH environment variable. The precise details of setting your PATH depend on the OS, and aren't specific to Java; if you don't know how, see your OS documentation.

[Jess in Action][AskingGoodQuestions]
Vicken Karaoghlanian
Ranch Hand

Joined: Jul 21, 2003
Posts: 522
Hi Amri and welcome to the Ranch.
If you are on Win2k/XP then here is how:
1) Right-click on 'My Computer', then goto 'Properties'.
2) Under 'Advanced' tab, click on 'Environment Variables'.
3) Double click on the 'Path' variable (Under System variables).
4) Add the path in which the java compiler is located. In my case i added D:\j2sdk1.4.2\bin
5) Here is how my 'path' variable looks like
If you are on a different platform (Linux for example) then that would be another story.
Hope this helps.

- Do not try and bend the spoon. That's impossible. Instead, only try to realize the truth. - What truth? - That there is no spoon!!!
Faisal Khan
Ranch Hand

Joined: Jun 29, 2003
Posts: 285


I would recommend adding a new variable called JAVA_HOME and set the value of this variable as d:\j2sdk1.4.2 (or whatever your drive is) and then in the classpath change d:\j2sdk1.4.2\bin to %JAVA_HOME%\bin - This would help when it comes to changing the J2SDK version you are using and you will only need to update the JAVA_HOME variable.

The secret to creativity is knowing how to hide your sources.
I agree. Here's the link:
subject: Javac Question
jQuery in Action, 3rd edition