Install JDK and set path in Java

This section guides you on how to download and set up Java on your machine. The following are the steps to set up the environment. Let’s start learning Install JDK and set path in Java.

How to install JDK

You should download Java SE on your computer. You can download a version based on your operating system.

How to set path in Java

Then you should be set path in Java on your device.

Windows users

1. Run the .exe file and follow the instructions to install Java on your Windows computer.

2. Then go to Control Panel -> System and Security -> System -> Advanced System Setting -> Advanced click on Environment Variables as highlighted below.

select environment variables on windows users for set path in Java

3. Then select the “Path” variable and click on Edit button as highlighted below.

select path for set path in Java

4. Then click the New and then add the path where java is installed. ( By default, java is installed in C:\Program Files\Java\jdk\bin folder OR C:\Program Files(x86)\Java\jdk\bin).

5. Click OK for save settings.

Linux users

1. Go to Application -> Accessories -> Terminal.

2. Type sudo apt-get install openjdk-8-jdk

3. Terminal using to your installation path export JAVA_HOME = /usr/lib/jvm/java-8-openjdk

4. Terminal using to your installation path export PATH = $PATH:/usr/lib/jvm/java-8-openjdk/bin

How to check whether Java installation is correct?
Open command prompt(cmd) and type javac-version

If the java installation correctly, you shall see this java version on your command prompt.

How to check whether set path in Java is correct?
Open command prompt(cmd) and type javac

Mac OS users

  • Open Terminal, type the following command.
export JAVA_HOME=/Library/Java/Home
  • Next, Type the following command on terminal.

This MAC OS set up the path temporarily. It means when you close the command prompt or terminal, the path settings will be lost and you will have to set the path.

Java is the most popular programming language and widely-used programming language for many years. You can free learning Java programming by following our Java articles sequentially.

Next chapter will teach you how to write and run your first Java program.

 1,454 total views,  3 views today

Leave a Comment

Your email address will not be published. Required fields are marked *