Technical Stuff

Start from basics

Java Installation on linux

Java Installation on linux
Java Installation on linux
5 (100%) 1 vote

Every One ! Today we are going to see Java installation on Linux

So, Lets begin !!!

Java Development Kit (JDK) Installation using tar.gz & with Alternative Methodology

Archive binary file (.tar.gz) Installation on linux platforms. You must be root to perform this installation.

Kindly follow below steps :

1.Download the file from Oracle site. Before the file can be downloaded, you must accept the license agreement. Then download the required file.
For Ex : jdk-6u45-linux-x64.tar.gz

2.Become root by running su and entering the super-user password.

  1. Now, Unpack the tarball (.tar.gz) and install the JDK.
    # tar -xvf jdk-6u45-linux-x64.tar.gz
  2. Delete the .tar.gz file if you want to save disk space.
  3. Exit the root shell. No need to reboot.

6.For setting up JAVA_HOME Variable, Kindly go into ‘home’ directory.
# vi . .bashrc
# export JAVA_HOME=/opt/jdk1.6.0_45
# export PATH=$PATH:/opt/jdk1.6.0_45/bin

7.Now check, Installation properly done or not by following command.
$ java –version.

8.To check java location.
$ which java

Alternatively,
1.Java archive has been kept in below mentioned location. After extracting Java archive file, we just need to set up Java using alternatives. Kindly find below command.
# tar -xvf jdk-6u45-linux-x64.tar.gz
# cd /opt/jdk1.6.0_45/
# alternatives –install /usr/bin/java java /opt/jdk1.6.0_45/bin/java 1
# alternatives –config java

2.Now, we may also required to set up javac and jar commands path using alternatives command with priorities.
# alternatives –install /usr/bin/java jar /opt/jdk1.6.0_45/bin/jar 1
# alternatives –install /usr/bin/javac javac /opt/jdk1.6.0_45/bin/javac 1
# alternatives –set jar /opt/jdk1.6.0_45/bin/jar
# alternatives –set javac /opt/jdk1.6.0_45/bin/javac

3.For setting up JAVA_HOME Variable, Kindly go into ‘/home’ directory.
# vi . .bashrc
# export JAVA_HOME=/opt/jdk1.6.0_45
# export PATH=$PATH:/opt/jdk1.6.0_45/bin

4.Now check, Installation properly done or not by following command.
$ java –version.

5.To check java location.
$ which java

Happy Learning !!!

If you have doubt or queries, you can definetely comment us or can mail us on [email protected]

If you have any recommedation for future blog, You can email us on [email protected]

Top Searches :

1.Introduction to Middleware
2. Introduction to Jboss
3. Installation of Jboss
4. Log4j
5. Heap Dump
6. Thread Dump
7. VAPT – Disabling Apache Coyoto
8. VAPT – HTTP Methods

4 thoughts on “Java Installation on linux

  1. bro nyc work but it should be
    vi .bashrc i guess instead of vi. .bashrc , dont know exactly but i think so , also it depends on server as to .bashprofile or .profile etc

    1. Hi, First of all its a OS level configuration, So in Linux, there are many configuration files for java entry i.e. bash_profile, .bashrc, . .bashrc or vi /etc/profile. Its depends on person to person, which one to use.

Leave a Reply

%d bloggers like this: