In this article, we will explain how to download & install Java in Linux or Ubuntu using commands.
First, I downloaded Linux Java tar ball from Oracle official website.
Then extract the tar ball using below command:
tar -xzvf Java-tarball
After extract the tarball, we need to setup environment variables in Linux .
Java_Home setup in Linux
Step 1: First, try with root user then open the .bashrc file in the commandline using below command:
vi ~/.bashrc
Step 2: After that Press “i” for insert then add then below export commands:
export JAVA_HOME = /usr/java/jdk1.8.00
export PATH = $JAVA_HOME/bin:$PATH
Step 3: Once exports the java paths then update the bashrc file.
Step 4: How to update the bashrc profile through cli using below command
source ~/.bashrc
How test Java & Java_Home setup is working or not properly!
1. Open the Command Line then enter the below command:
java -version
2.Check the java_home is set or not. Using below command:
echo$java_home
3. How to check java compiler is working or not.
javac
The above steps are very simple to setup java & java_home in Linux operating system.
Why we need to setup Java Home path, because some of the services are based on Java application. Here we provided simple steps for java setup & java environment variables in Linux or Ubuntu operating system for all users.
Basically, Java is an open-source programming language and most of the applications build on java related things. In any environment JDK is pre-requisites for some of the services or IDE (Integrated Development Environment).