Java Installation

Java Installation:

During installation of java using rpm file I found issues many times. after that I found a better way to install java from sun site, using below steps I have installed java successfully many times without facing any issues, we can also install multiple version of java easily if required.

 

Downloading latest java Archive:

 

# wget –-“http://download.orcale.com/otn-pub/java/jdk/8u101-b14/jdk-8u101-linux-x64.tar.gz

# tar –xvzf jdk-8u101-linux-x64.tar.gz

 

Install java with alternatives:

After extracting java archive file, we just need to set up use newer version of java using alternatives.

cd /opt/jdk1.8.0_101/

# alternatives –install /usr/bin/java java /opt/jdk1.8.0_101/bin/java 2

# alternatives –config java

 

There are 3 programs which provide ‘java’.

Selection    Command

———————————————–

*  1           /opt/jdk1.7.0_71/bin/java

+ 2           /opt/jdk1.8.0_45/bin/java

3           /opt/jdk1.8.0_91/bin/java

4           /opt/jdk1.8.0_101/bin/java

 

Enter to keep the current selection[+], or type selection number: 4

 

 

At this point JAVA 8 has been successfully installed on your system. We also recommend to setup javac and jar commands path using alternatives

 

#alternatives –install /usr/bin/jar jar /app/jdk1.8.0_101/bin/jar 2

#alternatives –install /usr/bin/javac javac /app/jdk1.8.0_101/bin/javac 2

#alternatives –set jar /app/jdk1.8.0_101/bin/jar

#alternatives –set javac /app/jdk1.8.0_101/bin/javac

 

 

Check Installed Java Version:

# java -version

java version “1.8.0_101”

Java(TM) SE Runtime Environment (build 1.8.0_101-b14)

Java HotSpot(TM) 64-Bit Server VM (build 25.101-b14, mixed mode

 

Configuring Environment Variables:

  • Setup JAVA_HOME variable
export JAVA_HOME=/app/jdk1.8.0_101

 

  • Setup JRE_HOME Variable
export JRE_HOME=/app/jdk1.8.0_101/jre

 

  • Setup PATH Variable
export PATH=$PATH:/app/jdk1.8.0_101/bin:/app/jdk1.8.0_101/jre/bin

 

 

 

Be the first to comment on "Java Installation"

Leave a comment

Your email address will not be published.


*