Monday, May 25, 2009

Setup java compiler in Windows 7 in ten steps

When I first decided to learn Java all alone, the first major setback I faced was how to setup the java compiler in Windows 7 (same for windows vista). Most of the search I did gave confusing description and were based on Windows XP which is kind of history now.

For guys who are new to Windows Vista and 7 following is the detailed description of setting up your java compiler:

  1. Download the Java Development Kit (JDK). You can download it here.
  2. Follow the instructions and install the JDK.
  3. Right-click the Computer icon on your desktop or start menu, click on properties.
  4. Click on Advanced system settings. A dialog box appears.
  5. Click on the Environment Variables button at the bottom-right of the System Properties dialog box.
  6. A dialog box named Environment Variables appears. Click on the TEMP variable in the User variables section. Now go down to the “Path” variable in the System Variables section and click on edit.
  7. The Edit System Variable dialog appears. At the end of the Variable value section append a semi-colon and then enter the path of the bin directory of you JDK. To copy the path of the bin directory follow the picture below

    java_address
  8. Then paste the path on the field as shown below. Make sure you have appended a semi-colon before you paste the address.

    java_setup
  9. Then click on OK as shown and then you are done. To confirm whether your settings are right, open command prompt and type “javac”. You should get a response like this on your prompt.

    javac
  10. Type ”java” and you should get something like this.

    java

If all of the above steps are followed correctly, you will be able to setup your java compiler and you can now start programming.

P.S.: I recommend you to use textpad instead of the usual command line interface to do your java programs. Its a freeware although it will ask you to register it.

10 comments:

Gourav Ray said...

Thanx a lot yaar......this method rocks but the only difficulty i found, that i had to restart my machine in order to set the path.

newayz htanx..

HaRsHa said...

hey...thanks for the process,but i got a problem."java" command is working but "javac" command is not working after the above process.

Prasannajeet Pani said...

Try Step 8 again, if it doesn't work den maybe you download JRE. I had the same prob once. I installed JDK and then javac worked

Edward said...

Hey prasannajeet, I have a problem... i followed your advice and downloaded the JRE and reinstalled it to my comp I already have the JDK installed in my computer but javac still does not work while java on the other hand works. what is your advice?

Prasannajeet Pani said...

Did you try doing Step 8 again?

Aseel said...

Thank you so much! =D

basavesh said...

Thank you very much,... it worked in few secs...

max-silence said...

Thanks for your help..
and of couse it works if you follow correctly these steps..

k9 said...

thanks... it works fine

Vallabhaneni Swathi said...

thnk u..itz wrkng fine with javac bt wn i type java itz displayng couldnt open...do i need 2 install jre also?or jdk hvng jre ?