Java Environment Setup

  • In order to compile and run your java source code first of all you have to install and configure the java compiler and run time environment in your system.

  • For this Java provides jdk (Java Development Kit).

  • You can download JDK from internet.
    Download the JDK according to your system configuration (32 bit or 64 bit).

  • After downloading install it, installation is as simple as other software.

  • After installation, set the path of java compiler.

  • Path setting process varies from platform to platform e.g. windows,linux etc. .

Path Setting on Windows OS :

There are the following steps to set the path :

STEP 1: First check the JDK installation directory and copy the path.
By default it will be at the location
"C:\Program Files\Java\jdk1.8.0_25\bin";
Copy this path

STEP 2: Now Right click on Computer goto properties.

STEP 3: The above step will open a new window, click on 'Advanced system settings' .

STEP 4: The above step will open a new window, click on 'Environment Variables...' button.

STEP 5: The above step will open a new window as shown below
In new User Variable window, type path in variable name box.
And paste the path that you have copied in Step1 into variable value box.
Now cick on OK buttons.
NOTE: IF path variable already exist then inplace of "New..." button click on "Edit.." button.
And paste the copied path from "Step1" at the end of 'variable value' box followed by semicolon ' ; '.

STEP 6: To check whether the path is successful set or not, open the command prompt, and type the following command.
javac -version
To open command prompt Press +r , type "cmd" and press OK button.
If the path is successful set it will show you the version like this:

Path Setting on Solaris and Linux:

To find out if the path is properly set, execute:

% java -version

This will print the version of the java tool, if it can find it.
If the version is old or you get the error java: Command not found, then the path is not properly set.

To set the path permanently, set the path in your startup file.

For C shell (csh), edit the startup file (~/.cshrc):

set path=(/usr/local/jdk1.7.0/bin $path)

For bash, edit the startup file (~/.bashrc):


export PATH

For sh, edit the profile file (~/.profile):
export PATH

Then load the startup file and verify that the path is set by repeating the java command:

For C shell (csh):

% source ~/.cshrc
% java -version

For bash, or sh:

% . /.profile
% java -version

Path Setting on Mac OS x:

To run a different version of Java, either specify the full path, or use the java_home tool:

% /usr/libexec/java_home -v 1.8.0_73 --exec javac -version

Next topic Writing / Compilation First Program


Training For College Campus

We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.

Please mail your requirement at

Projects For Students

Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.

Students can mail requirement at

(8AM to 10PM):

+91-9026070669 , +91-9451396824

© 2016,, All rights reserved