In this tutorial we will learn how to download and install
Java and then setting path to make Java programs run.
Java and then setting path to make Java programs run.
Downloading and Installing
- To download the latest JDK version visit link: http://www.oracle.com/technetwork/java/javase/downloads/index.html
- Now click on Download button to go to download page.
- Select Accept License
Agreement and then download appropriate version for your operating system.
- After downloading, install the JDK.
- If installation is done properly you can see two files java and javac by going to C:Program FilesJavajdk1.7.0_60bin.
How to set Java path?
To make java programs compile and run you have to set the
path of java compiler. You can set java path in two ways: temporary and
permanent.
path of java compiler. You can set java path in two ways: temporary and
permanent.
Temporary Java path setting
- Copy the path of bin folder by going to jdk/bin i.e. C:Program
FilesJavajdk1.7.0_60bin. Here jdk1.7.0_60 (will vary according to jdk version).
- Open command prompt and write set path=C:Program FilesJavajdk1.7.0_60bin and then press enter.
- This method will work only one time. After closing cmd you
have to repeat the same process again.
Permanent Java path setting
- Right click on Computer
and then select Properties. - Then goto Advanced
tab and click on Environment Variables. - Now click on new
and then in variable name field write path and
in value field write the path of bin folder i.e. C:Program FilesJavajdk1.7.0_60bin
- Click ok to save settings. You have done!
- This will permanently set the path and you can run programs
whenever you want.
Check path setting was properly or not
- You can confirm whether the path setting was properly or
not. Just open cmd again, write javac
and press enter.
- If it will show details about the java compiler then it is ok.
- If it will show and
error like ‘javac’ is not recognized as
an internal or external command then you have done something wrong. Check
the whole process again.
In the next tutorial we will discuss about how to compile and run java programs.
Thanks! I've been having trouble with this, been putting the directory in the System Variables instead of the User Variables.