How to Install Java in Windows & Linux – Java Environment Setup

1. Objective

In this Java tutorial, we are going to learn about Java Environment Setup- install Java 8 in Windows and Linux, how to install Java 8 on both platforms.

So, let us start with Install Java 8.

How to install Java

How to Install Java in Windows & Linux – Java Environment Setup

2. Introduction to Java Environment Setup

Java is a general-purpose, object-oriented programming language. It is language that uses the classes as a base for programs.
Java applications are compiled by bytecode which runs on Java Runtime regardless of any architecture.

The following are environment settings for both Linux and Windows. JVM, JRE, and JDK every one of the three are stage subordinate (dependent) since the design of each Operating System are different. But, Java is platform independent.

Read more about Features of Java Programming Language

3. How to Install Java 8

a. Install Java 8 For Windows

i. Download the JDK Java 8 from
http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

 Install Java in Windows & Linux - Java Environment Setup

Step.1 Install Java in Windows 8

Click on the links for Windows 32 Bit or Windows 64 Bit as required.

ii. Click on exe. file, and run it. Then follow the instructions to download it. Once, it is installed you will have to do the setup for the environment.

Let’s know about Variables in Java & Linear Data Structures in Java.

Step.1 Install Java in Windows 8

Step.1 Install Java in Windows 8

iii. After this you need to go to the Control Panel > System and Security > System. Under the option Advanced System Settings, we need to click on Environment variables.

iv. Now under the System variables, we need to alter the “path” so that path for Java is also added to it and click on the Edit button.
v. You will need to add a path where the downloaded file is stored and then click ‘ok’.

Step 5. Install Java 8 For Windows

Step 5. Install Java 8 For Windows

vi. Save the settings and you are done.

Let’s look at Java Constructor & Java Polymorphism in detail.

vii. To learn more about it click on the option ‘Next Steps’ and it will take you to the website.

Step 7. Install Java 8 For Windows

Step 7. Install Java 8 For Windows

b. Install Java 8 For Linux

There are many ways to install Java in Linux, but we will go with the easiest way which is by using terminal. OpenJDK is a free and open source implementation of the Java.

i. We will need to install OpenJDK.

ii. In the second step we will need to go to Application > Accessories > Terminal.

iii. Then we will need to type the command which is given below

sudo apt-get install openjdk-8-jdk

Let’s see Java Access Modifiers & Java Inheritance in detail.

iv. In case of “JAVA_HOME” (Environment Variable) type the command given below in the terminal.

export JAVA_HOME = /usr/lib/jvm/java-8-openjdk

v. In case of “PATH” (Environment Value) type the command given below in the terminal.

export PATH = $PATH:/usr/lib/jvm/java-8-openjdk/bin

vi. You are done.

Java Quiz

4. Conclusion

In this tutorial we learned how to install Java – Java Environment Setup for Windows and Linux, with this we can run the program on both the networks. Furthermore, if you have any query, feel free to ask in a comment section.

See Also- Java Regex & Java Exception Handling 

For reference

3 Responses

  1. Naresh says:

    how to install java in windows

  2. ssvkumar86 says:

    I have installed java in linux through JDK:sudo apt-get install oracle-java8-installer

    do i need to install above specified java JDK:sudo apt-get install openjdk-8-jdk in linux again?

    • Rahul says:

      If you have already installed oracle Java, no need to install open jdk again. Just check whether java is installed using following command:
      java -version

Leave a Reply

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

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.