Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 11

How to setup javac command

Credit to http://www.skylit.com/javamethods/faqs/javaindos.html
by Fir09 :D

1st make sure you already have install jdk Open control panel -> System -> Advance system setting

by Fir09 :D

Then click Environment Variables

by Fir09 :D

At System variables, click Path and click Edit

by Fir09 :D

you have to be very careful because your system might crash if you make a mistake. Proceed with extreme caution! At the end in the text box of Variable value, add path of your installed jdk, for example ;C:\Program Files\Java\jdk1.7.0\bin. Depend on jdk version you install. For more safe, browse your jdk first[by default in C:\Program Files\Java\jdk1.7.0\bin] and copy the path.

by Fir09 :D

Then just click OK and OK and OK.. Hehe To test javac. 1st create your java folder in C:

by Fir09 :D

Open notepad, create a simple java file like this:

Then, save as HelloWorld.java in your java folder


by Fir09 :D

Then open command prompt (cmd) Go to your java directory, type cd C:\myJava

by Fir09 :D

Type javac HelloWorld.java this will compile your java. If nothing happens means no error. You should see HelloWorld.class in your folder

by Fir09 :D

To run HelloWorld.java file, type : java HelloWorld You should get output : Hello, World!

by Fir09 :D

The END

Note: javac is use to compile. you also can use other software like kawa or bluej to compile your java file. Tq.

by Fir09 :D

You might also like