In this chapter you will learn:
- How to Download and Install Java in Windows 10/8/7, Vista or XP?
- How to set Java Path in Different OS?
- Ready to write and execute Java Program
This is very fundamental chapter of learning java in which you will learn downloading Java, Installation and setting path. If you know how to signup in facebook you are capable in doing all these tasks yourself. It is as easy as posting your status on facebook or twitter. Believe me, I am not joking. I will guide you at every steps with screenshots and at the end you feel proud on yourself.
If your PC doesn’t have Java, download it from java official site. Go to Java Official Site
After downloading Java, it’s time to install it on your PC. It is not a difficult task and as easy as installing other windows software.
Steps 1: Double click on java executable file which you have downloaded.
Steps 2: The installation process is started. Windows security will ask you whether allow or not to run this software. Click yes if asked.
Steps 3: Click on Install button to accept license terms and start Installation.
Steps 4: Now just do Next > Next > Finish.
Steps 5: Congratulations!!! You have installed Java Successfully on your PC.
Now, it’s time to check whether Java is installed on your PC or not.
Go to C Drive > Program Files. Here in the list you will find Java folder.
If you get this folder it means Java has been installed on your PC. But it doesn’t mean you are ready for writing and executing java program. One more step is ahead. It is setting Path in System Environment Variable. Until you set path you are not able to compile java code.
Set Java Path in System Environment Variable
In order to setting java path you need to open system variable windows first. To open system variable windows you follow these steps.
Windows 10/8/7, Vista and XP
Steps 1: Right click on MyComputer, Computer or This PC and select properties.
Steps 2: In the left side, there is link Advanced System Settings. Click on it.
Steps 3: Go to Advanced tab and click on Environment Variables.
Steps 4: In the System Variable Column click on New.
Steps 5: In the Variable Name write JAVA_HOME and in the Variable Value field Write Java Installation path. It is in your program file location as C:\Program Files\Java\jdk1.8.0_65
Steps 6: Click on OK to save.
Steps 7: Now find Path in the variable name and select it.
Steps 8: Click on Edit
Steps 9: Add %JAVA_HOME%\bin at the end. You must put a semicolon (;) at the end of previous value before adding new value. Do not delete or alter previous written value. Softly put a semicolon at the end if there is no semicolon and then put your JAVA_HOME value.
Steps 10: Click OK to save.
Now it’s time to test whether Java is working on your machine or not. In order to test java, do the following steps.
1. Open command prompt. To open command prompt press windows + R key and write cmd and press enter. Write javac in the command prompt. If you get list of java option then cheers! Java is ready on your machine and now you can start java journey.
In this chapter you have learned how to Download, Install and set path for Java. Setting environment variable is little bit tricky but if you are learning Java then this level of tech is expected from you. In the next chapter you will write and execute your first JAVA program.