Professional Documents
Culture Documents
Instalar JAVA Centos
Instalar JAVA Centos
Instalar JAVA Centos
During installation of Java using rpm files I faced 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. Oracle has also released Java 8. To install it read article Install
Java 8 in CentOS, Redhat and Fedora.
Use following step by step instructions to install or update java. I recommend to read
carefully instruction for downloading java from Linux command line.
# cd /opt/
# wget --no-cookies --no-check-certificate --header "Cookie:
gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux
-i586.tar.gz"
For 64 Bit –
# cd /opt/
# wget --no-cookies --no-check-certificate --header "Cookie:
gpw_e24=http%3A%2F%2Fwww.oracle.com%2F;
oraclelicense=accept-securebackup-cookie"
"http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux
-x64.tar.gz"
Note: In any case if above command failed to download and you need to download java
through Linux terminal, watch below screen cast ( http://screencast.com/t/wf9bQ0XjDPxT
), You are required a graphical browser.
After completing download, Extract archive using following command. Use archive file as
per your system configuration. For this example we are using 32 bit machine.
After extracting java archive file, we just need to set up to use newer version of java
using alternatives. Use the following commands to do it.
# cd /opt/jdk1.7.0_67/
# alternatives --install /usr/bin/java java /opt/jdk1.7.0_67/bin/java 2
# alternatives --config java
Selection Command
-----------------------------------------------
* 1 /usr/lib/jvm/jre-1.6.0-openjdk/bin/java
+ 2 /opt/jdk1.7.0_60/bin/java
3 /opt/jdk1.7.0_65/bin/java
4 /opt/jdk1.7.0_67/bin/java
Enter to keep the current selection[+], or type selection number: 4 [Press Enter]
Now you may also required to setup javac and jar commands path using alternatives
Use following command to check which version of java is currently being used by
system.
# java -version
Most of java based application’s uses environment variables to work. Use following
commands to set up it.
I hope above steps will help you for installing java on your Linux system. You can follow
above steps to install multiple version of java as same time but you can use only one
version at a time