703-401-5432    contact@compsciprep.com


How to install JRE and JDK


Step 1: Check if java installed on your machine already.

On windows go to Start run and type cmd you will see Command window as below and type at the prompt as shown and press enter key.

If you see as follows that means java is installed

If you see as follows that means java is installed which means your runtime environment is ready.

Step 2: Install jdk (Java Development Kit)

Go to google.com and type jdk download. Click on the first link that will take you to oracle.com website where you will click again on jdk download button and you will see a screen as shown below. Click Accept radio button and click on one of the below links.

If you have windows 7 or 8 use the x64 link and if you are using windows XP then use x86 link. Once the file is downloaded, double click on the file and install the software. Once the installation is complete you must see your jdk something like shown below, however it is better if you pay attention while installing, so you know in which directory the jdk has been installed. Most likely it would be in C:\Program Files\java\. My directory shows like this.

Step 3: Checking to see if Java compiler is working fine. Got to step 1 and type the command javac and if you see as shown below then you can skip step 4 and go to step 5

But if you get as below then you must go to step 4.

Step 4: Setting the jdk path in the environment variables. Go to Start -- run and type env and you see like this

Select path variable and click on edit button, another popup will come there make sure you have your cursor at the very end of the path and then type ; (semicolon) if it is not there already. There type C:\Program Files\java\jdk160_05\bin; alternatively you can copy and paste this path from windows explorer. Please note this is only example, you must be able to figure out by now where exactly you have the jdk installed. Then save the popup and save the main popup and exit from there and now go back to step 1 and open a new command and type javac. This time the window should show as shown in the step 3.

Step 5: Writing, Compiling and Running java code.

Open notepad and type as follows and save has HelloWorld.java please note java is case sensitive.

         

Please note that, because this is notepad, you must select save as type as “All Files” and the file name must be Hello.java Also note that I create a folder to save all my work. Once it is saved you can come back to command window type as below to go that folder.

You see only file at this point and let us compile now and run as shown below. If there are no errors in the file that you have typed, you should be able to see that the class file has been generated then you can run the file and see the output as shown.