Professional Documents
Culture Documents
JAVA java, java 8, Java_home, jdk, jdk-jre, jre, jre_home, openjdk, oracle java, sun java
This tutorial helps you to install Java 8 or update Java on your system. Read the instruction
carefully before downloading Java from Linux command line. To Install Java 8 in Ubuntu
and LinuxMint read This Article.
POPULAR POSTS
# 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/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.tar.gz"
# tar xzf jdk-8u171-linux-x64.tar.gz
# cd /opt/jdk1.8.0_171/
# alternatives --install /usr/bin/java java /opt/jdk1.8.0_171/bin/java 2
# alternatives --config java
Selection Command
-----------------------------------------------
* 1 /opt/jdk1.7.0_71/bin/java
+ 2 /opt/jdk1.8.0_45/bin/java
3 /opt/jdk1.8.0_144/bin/java
4 /opt/jdk1.8.0_171/bin/java
At this point JAVA 8 has been successfully installed on your system. We also recommend
to setup javac and jar commands path using alternatives
# java -version
# export JAVA_HOME=/opt/jdk1.8.0_171
# export JRE_HOME=/opt/jdk1.8.0_171/jre
# export PATH=$PATH:/opt/jdk1.8.0_171/bin:/opt/jdk1.8.0_171/jre/bin
Also add the above commands to /etc/bashrc file to auto set environment variables on
the system boot.
SHARE IT!
RAHUL K.
I, Rahul Kumar am the founder and chief editor of TecAdmin.net. I am a
Red Hat Certified Engineer (RHCE) and working as an IT professional since
2009..
RELATED POSTS
118 COMMENTS
chmod +x /opt/jdk1.8.0_161/bin/java
I’ve following you for quite some time and I really appreciate your contribution. However I’ve never been able
to fathom how alternative command works.
SD REPLY TO SD
January 18, 2018 at 1:35 pm
Download Path incorrect
cd /opt
ln -s /opt/jdk1.8.0_151 jdk1.8
export JAVA_HOME=/opt/jdk1.8
export JRE_HOME=/opt/jdk1.8/jre
export PATH=$PATH:/opt/jdk1.8/bin:/opt/jdk1.8/jre/bin
Apparently it’s going to work yes but i am having a problem with this command:
It’s coming with 404 not found HTTP request, can you help me, please?
After exporting the path, ls command and most of the command is not working. Could you please help me on
this. I am so tired.
export PATH=$PATH:
MO CHI REPLY TO MO
January 25, 2017 at 3:55 am
Thank you so much.
I had this one and was point to a old java version. Just deleted and is working fine.
One difference: setting the variables in /etc/environment file almost disabled the bash shell on my CentOS 7.
So I defined them in /etc/profile.d/custom.sh, it works.
J REPLY TO J
February 23, 2016 at 12:19 am
I removed the step of setting environment file which was empty on my machine, because adding those lines
to environment file caused serious problem (path lost).
This does not allow for a yum update in CentOS or Red Hat.
Thanks for any leads on this. It’s a real pain to manually update. Though I see a benefit in that you would not
“yank out” the current version out from under your running java applications. It does appear to make the
upgrade safer, but manual too.
Thanks,
I too put the “export PATH” stuff in /etc/environment and tried to restart my machine.
Since then i am not able to login back into my Ubuntu machine. ;-(
Could you please tell how i can get the login thing working again in my system ?
I had this problem too with Centos 7. The reason is that if you put the entries
in /etc/environment it messes up the PATH environment setting which
includes removing reference to /bin.
Best regards…Paul
This happens from that I “installed java or detroyed with java my pc” I don’t know why:
I have done this:
echo “export JAVA_HOME=/opt/jdk1.8.0_101” > /etc/profile.d/jre.sh
echo “export JRE_HOME=/opt/jdk1.8.0_101/jre” >> /etc/profile.d/jre.sh
echo “export PATH=$PATH:/opt/jdk1.8.0_101/bin:/opt/jdk1.8.0_101/jre/bin” >> /etc/profile.d/jre.sh
according to Mark Smith user. All run fine. after Reboot I get that message in my terminal.
I am afraid. Because I don’t know if this affects only to java or all my apps in mi machine
Centos7
Please help!
I have followed your steps but getting following error when running command ‘java -version’
You have downloaded wrong java archive as your system architecture. Check your system
architecture using command below and download correct java archive.
uname -m
You have downloaded wrong java archive as your system architecture. Check your system
architecture using command below and download correct java archive.
uname -m
http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/
ln -s /opt/jdk1.8.0_45/bin/java java
– In case folks are not familar, the export commands can go into ~/.bash_profile , but careful not to overwrite
your existing “PATH”, instead append to it. This is an example of my ~/.bash_profile
# .bash_profile
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$HOME/Dropbox/Apps/Bash_path_linux/:/opt/jdk1.8.0_05/bin:/opt/jdk1.8.0_05/jre/bin
export JAVA_HOME=/opt/jdk1.8.0_05
export JRE_HOME=/opt/jdk1.8.0_05/jre
export PATH
Hope it helps.
Running “uname -a” returns , which I presume is 64bit, Im using Centos 6. #1 SMP Mon Aug 11
18:47:39 MSK 2014 x86_64 x86_64 x86_64 GNU/Linux. I tried installing via both SSH and
terminal of the VPS itself. Both returned the same result, what have I done wrong? Any help
would be greatly appreciated.
LEAVE A REPLY
COMMENTS *
SUBMIT
NOTIFY ME OF FOLLOW-UP COMMENTS BY EMAIL.
All rights reserved. © 2013-2018 TecAdmin.net. This site uses cookies. By using this website you agree our term and services