View Full Version : Compiling Java Programs

10-20-2008, 08:10 PM
Hi all. I've recently started to learn how to code in Java and have made a couple of successful attempts at simple stuff using the Eclipse editor. My programs run nicely in there no problem. When I run > cmd and try to use javac (i.e. javac HelloWorld.java) to compile the program I'm getting an error: 'javac' is not recognized as an internal or external command, operable program or batch file.' Can anyone tell me what I'm missing please? Many thanks in advance, Magoo.

10-24-2008, 06:58 PM
From what I have already done in Java, to be able to compile a program you need to compile a program in Eclipse, select the project in the pane on the left hand side. Then select Project->Rebuild Project from the menu. Compilation errors are displayed in a window at the bottom of the Eclipse frame. Click on an error message, and the cursor moves to the offending line in the edit window.
Or you can try this:

10-24-2008, 09:25 PM
Thankyou very kindly Mr. Sabbath :) Whilst exploring and following your s***estion it quickly became apparent that I'd experienced another 'blonde' moment. It's times like these when I think: 'if only I had read that before I sent the post'. Is everyone aware that javac (the java compiler) does not download with the J2SDK environment package and is not included in the download of Eclipse either? I guess now I've downloaded this it should cure my problem. Thanks again for your input Blacksabbath. Much appreciated :)

10-24-2008, 11:50 PM
If from command prompt, you'll need to change directory to the folder javac is in ("cd path").