The document provides steps to install Java 7 (JDK 7u79) on CentOS/RHEL 7/6/5. It begins with downloading the latest Java archive from Oracle's website. It then uses the 'alternatives' command to set the Java version and configure environment variables like JAVA_HOME. The final steps check the installed Java version and configure additional tools like jar and javac using alternatives.
1. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 1/24
JAVA, Linux Tutorials 75 Comments
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
How to Install Java 8 in CentOS/RHEL 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.
14
MAY
2015
How to Install JAVA
7 (JDK 7u79) on
CentOS/RHEL 7/6/5
and Fedora
Written by Rahul
Share it! 47Like 17
Search Now
Working with
FOR Loop in
Bash Shell with
Examples
January 7,
2015
How To Setup
UFW for
Firewall on
Ubuntu and
Debian
September 8,
2015
How to Install Mencoder &
MPlayer on Linux
April 25, 2014
IP Failover
Setup using
KeepAlived on
CentOS/RHEL 6
September 19,
2013
RANDOM POSTS
HOME FEEDBACK FUNNY TOOLS TUTORIALS SUBMIT ARTICLE ABOUT US
2. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 2/24
Downloading Latest Java Archive
Java latest archive is available on its official site. We
recommend to download latest version of Java from
Oracle official website. After completing download also
extract archive with given commands.
For 64 Bit:-
# cd /opt/
# wget ‐‐no‐cookies ‐‐no‐check‐certificate ‐‐header "Cookie: gpw_e24=http%3A%2F%2Fwww.or
# tar xzf jdk‐7u79‐linux‐x64.tar.gz
For 32 Bit:-
# cd /opt/
# wget ‐‐no‐cookies ‐‐no‐check‐certificate ‐‐header "Cookie: gpw_e24=http%3A%2F%2Fwww.or
# tar xzf jdk‐7u79‐linux‐i586.tar.gz
Note: If Above wget command doesn’t not work for you
watch this example video to download java source
archive using terminal.
Use archive file as per your system configuration. For
this example we are using CentOS 7.0 (64 bit) system.
Install Java with Alternatives
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.
TecAdmin
+ 2,598
Follow
4. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 4/24
SHARE IT!
RAHUL
Configuring Environment Variables
Most of Java based application’s uses environment
variables to work. Use following commands to set up
these variable properly. It’s also good to add following
commands to any start-up script like ~/.bashrc or
~/.bash_profile.
Setup JAVA_HOME Variable
# export JAVA_HOME=/opt/jdk1.7.0_79
Setup JRE_HOME Variable
# export JRE_HOME=/opt/jdk1.7.0_79/jre
Setup PATH Variable
# export PATH=$PATH:/opt/jdk1.7.0_79/bin:/opt/jdk1.7.0_79/jre/bin
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.
Founder of TecAdmin.net. I love to work with Linux and other open
source application. Also I like to share knowledge with my friends
and other Linux users. Follow me on Twitter, Add me on Google+ or
Like Facebook page.
5. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 5/24
75 COMMENTS
REPLY TO MRGMAWMRGMAW
August 1, 2013 at 3:30 pm
Great, thank you.
REPLY TO CTCT
August 31, 2013 at 2:58 am
Tried to do this but at Step 1, after copy/pasting the wget command, I
get:
Resolving download.oracle.com… 23.0.160.209, 23.0.160.198
Connecting to download.oracle.com|23.0.160.209|:80… connected.
HTTP request sent, awaiting response… 403 Forbidden
2013-08-30 22:21:20 ERROR 403: Forbidden.
REPLY TO RAHULRAHUL
August 31, 2013 at 3:23 am
Hi CT,
Actually you are getting issue because of old url. You can
see Java download url having a parameter AuthParam,
Which can be used for a shot time only. If you are using
Gnome desktop, you can simply navigate to below url and
download.
http://www.oracle.com/technetwork/java/javase/downloads/jdk7-
PREVIOUS ARTICLE
PHP – Split a String
into Array with
Delimiter
NEXT ARTICLE
How to Enable Telnet
on Windows 7/8
6. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 6/24
REPLY TO GIRISHGIRISH
September 30, 2013 at 8:26 am
If i am using yum install jdk1.7.0 means ,where is the java _home
path?
how to set the java path
downloads-1880260.html
If you are using terminal, Use below video tutorial, which i
always used to download java on terminal.
http://screencast.com/t/wf9bQ0XjDPxT
I hope it will help you.
Thanks
REPLY TO CTCT
August 31, 2013 at 3:50 am
Thanks Rahul, I figured that out and went to the
website with my browser and downloaded it after
accepting the license.
But I am not a seasoned linux user (despite
having used unix for a long time) and it seems I
am getting stuck at every turn. My Centos (5.4)
does not understand “alternatives”. Do I have to
install this first?
REPLY TO RAHULRAHUL
August 31, 2013 at 4:22 am
Hi CT,
/usr/sbin/alternatives command comes
from chkconfig package. Check if you
have this package in you system.
# rpm -ql chkconfig
7. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 7/24
if i ive which java
i got /usr/bin/java
i am in confusion to export java_home path..
please help
REPLY TO YOGOYOGO
December 11, 2013 at 2:38 am
Thanks, its great post
congratulations
REPLY TO DANDAN BRIAN
December 12, 2013 at 4:51 pm
Thank you so much for this guide. This helped me a lot.
REPLY TO MATTMATT
January 2, 2014 at 5:01 am
Outstanding! I read carefully, followed your directions exactly and it
went smoothly on the first try! You’re amazing!
REPLY TO TOMASTOMAS
January 16, 2014 at 5:03 pm
Nice article thanks for posting it.
It should be noted that there are other commands from the JDK/JRE
REPLY TO RAHULRAHUL
October 5, 2013 at 4:59 am
Hi Girish,
You can use following command to find where “bin” and
other files is been installed.
# rpm -ql jdk1.7.0
8. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 8/24
referenced in the alternatives directory that may cause problems if
not all of the alternatives are updated. If you look at /etc/alternatives
and look for all of the associated applications that are provided with
java (maybe something like ls -l /etc/alternatives |grep
‘jvm|java|jre|jdk’ ) you will notice much more than just the java
command.
For example, if you followed steps 1-2 and then ran javac, javaws,
javadoc, jar, keytool, appletviewer, javah, etc… you will not get those
installed from the jdk tarball in /opt but rather those installed via
package (if something like the java-1.6.0-openjdk-devel package is
installed) .
After step 4 you will get it but not because of the alternatives system
but because of the change in the PATH variable in step 4 which is
user specific unless set in /etc/profile, /etc/profile.d/, or other
system wide environment. So if you have a system process that uses
javac, javadoc or a command other than java I believe you will not get
the version in /opt. I believe that debian based systems (mint,
ubuntu, etc.) have an update-java-alternatives command used for
this purpose (to update all java related commands) but I don’t know
at the moment if it is available for RHEL and derivatives like CentOS.
Just thought I would share this in case other ran into issues.
REPLY TO LEOLEO
October 17, 2014 at 7:15 am
Thanks Tomas, That is great help.
I run into this because I typed java after I finished these
commands:
# cd /opt/jdk1.7.0_67/
# alternatives –install /usr/bin/java java
/opt/jdk1.7.0_67/bin/java 2
# alternatives –config java
and it works.
but I can’t make it work after I finish these command:
# alternatives –install /usr/bin/jar jar
/opt/jdk1.7.0_67/bin/jar 2
# alternatives –install /usr/bin/javac javac
/opt/jdk1.7.0_67/bin/javac 2
# alternatives –set jar /opt/jdk1.7.0_67/bin/jar
# alternatives –set javac /opt/jdk1.7.0_67/bin/javac
System told me “-bash: javac: command not found”.
9. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 9/24
REPLY TO TAMILSELVANTAMILSELVAN
January 30, 2014 at 10:48 am
HI Team
i not able to configure java. but i face this error “””Error: dl failure on
line 863
Error: failed /opt/jdk1.7.0_51/jre/lib/i386/client/libjvm.so, because
/opt/jdk1.7.0_51/jre/lib/i386/client/libjvm.so: cannot restore segment
prot after reloc: Permission denied””” while java -version run this
command.
i am using centos 5.8
please help me
REPLY TO RAHULRAHUL KUMAR
January 31, 2014 at 3:45 am
Hi,
Do you have SELinux enabled ?
REPLY TO TAMILSELVANTAMILSELVAN
January 31, 2014 at 4:15 am
Hi Rahul,
yes its enabled ..
REPLY TO RAHULRAHUL KUMAR
January 31, 2014 at 5:05 am
Hi Tamilselvan,
You can disable SELinux to fix this issue.
If you still need keep SELinux enforcing,
you need to add some security context on
libjvm.so file.
10. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 10/24
REPLY TO REMCOREMCO
February 2, 2014 at 8:26 am
HI, i have a clean install of centos 6.5 and i did everything only
instead of JDK i installed JRE because i don’t need JDK
when i come to the part of checkin java -version centos returned
-bash: java: command not found
did i miss something??
REPLY TO GONZALOGONZALO
February 6, 2014 at 6:12 pm
Thank you so much. It worked like a charm on Centos 5.9
REPLY TO IONION
February 20, 2014 at 4:30 pm
Thanks. Simple and useful.
REPLY TO SALONISALONI
February 25, 2014 at 10:51 am
Its made very simple to understand and install. Thnx a lot Rahul
This topic may help you for this.
REPLY TO REMCOREMCO
February 2, 2014 at 8:41 am
Never mind, i fixed it by doing step 4 instead of step 3 and
when i got the path variable set to the right bin
it worked thanks for your tut :D
11. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 11/24
REPLY TO ABRAMOABRAMO
February 26, 2014 at 1:41 pm
Very good step-by-step instructions. Worked for me perfect first
time. Many thanks for sharing. Keep up the good work! Best, Abramo
REPLY TO RAJRAJ
February 27, 2014 at 9:36 am
I installed all the steps, however, I am facing issue setting-up
JAVA_HOME and JRE_HOME. Once I export both the home and exit,
the path resets to its original states.. JAVA_HOME turns to null
when I echo $JAVA_HOME or echo $JRE_HOME
I am using su to set them up.
Otherwise the installation instructions are superb. The only issue I
found in the step is that the directory structure you mentioned is
hadoop/hadoop whereas (if I am not wrong) it should have been
hadoop/hadoop-1.2.1 Please let me know if I am wrong so I can
rectify it.
Thanks in advance.
Raj
REPLY TO RAJRAJ
February 27, 2014 at 9:44 am
Sorry! I mixed two things in the above email… only first portion was
for your reference ….I am missing something here. In UNIX
environment we used .profile. What is the equivalent file in linux to
set PATH?
REPLY TO KDKD
March 6, 2014 at 11:39 am
Thanks man!
CASEY WISE
12. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 12/24
REPLY TO CASEYCASEY WISE
March 27, 2014 at 11:55 pm
Rahul, big stacks of thanks for posting this and sharing your
knowledge, worked perfectly. You get a gold star today.
REPLY TO MIQUEL72MIQUEL72
April 7, 2014 at 2:12 pm
Just thank you very much for these clear instructions.
REPLY TO BRIANBRIAN
April 22, 2014 at 4:44 pm
If you use the RHEL Supplementary Repo, java-1.7.0-oracle* is
already provided as an RPM and does all this for you (including the
mess with alternatives). It is more comprehensive.
REPLY TO ILYASSILYASS
April 28, 2014 at 11:38 am
thank you
REPLY TO VIKTORIIAVIKTORIIA
May 22, 2014 at 9:07 pm
Thanks, Rahul! That’s a perfect instruction. :-)
REPLY TO SRIKARSRIKAR
June 16, 2014 at 10:13 am
Hi Rahul
How to upgrade tomcat 7.0.50 to 7.0.54 in Windows OS ?
REPLY TO ABULKHAIRABULKHAIR
13. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 13/24
June 20, 2014 at 7:54 am
I am installing 32 bit jdk on centos 64 bit .
After following yours steps when i fire command “java -version ” i
got error
bash:/usr/bin/java:/lib/id-linux.so.2: bad elf interpreter no such file
or directory
Please help, why is it so.
REPLY TO RAJANRAJAN PRASAD UPADHYAY
July 4, 2014 at 4:45 am
If the system didnot find the “alternatives” command in
centos(redhat), You could use “/usr/sbin/alternatives” instead of
“alternatives”
ANUP
REPLY TO JOEYJOEY
June 26, 2014 at 8:37 am
Try this:
yum install glibc.i686
REPLY TO BOBBYBOBBY
October 7, 2014 at 6:59 pm
I yum installed half the internet and couldn’t get
all my dependencies resolved. Started over with
earlier VM snapshot and your one library
suggestion fixed everything. Thank you.
REPLY TO GATORGATOR
November 13, 2014 at 5:10 am
Hi,
I have solved the liunx.so issue by using your
method. Thanks alot.
14. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 14/24
REPLY TO ANUPANUP
July 5, 2014 at 1:30 am
Thanks Rahhul
Very nice and informative article.
Rahul do you have any Idea about GTK package on linux. I am trying
to install Java Eclipse editor on my Linux bot bit its failing to start.
Installation success but unable to start . It would be very kind help if
you give some pointer. below is error. I googled a lot but did not
found solution.
00:00.72 ERROR [main]
org.eclipse.equinox.log.internal.ExtendedLogReaderServiceFactory
safeLogged
Application error
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
org.eclipse.swt.SWTError: No more handles [gtk_init_check() failed]
at org.eclipse.swt.SWT.error(SWT.java:4387)
at org.eclipse.swt.widgets.Display.createDisplay(Display.java:913)
at org.eclipse.swt.widgets.Display.create(Display.java:899)
at org.eclipse.swt.graphics.Device.(Device.java:156)
Please help karo bahe , mai bahut pareshani mei hu ..
Thanks
Anup
REPLY TO STEVENSTEVEN
July 14, 2014 at 2:46 pm
Wonderful instructions. It worked without an incident.
REPLY TO DHIRENDHIREN
August 18, 2014 at 5:47 am
thanks for your help
REPLY TO NITANNITAN
August 20, 2014 at 6:09 pm
15. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 15/24
Hello Rahul sir..
I hope sir yor are doing well and sir i have install many things on
linux with the of you webiste and but i need more help i always get
so many issue during compiling MYsql 5.5 or 5.6 ,so please try to help
me in same topic and if you have already worked on it , than share
the URl with me , i will be thankfull to you..
REPLY TO PRAVESHPRAVESH K
August 24, 2014 at 11:33 am
I am setting path of java but it is not getting executed. Kindly guide
me to set path of java for hadoop installation in rhel6
REPLY TO SYEDSYED
September 15, 2014 at 3:50 am
Awesome Tutorial
REPLY TO LUCYLUCY
September 24, 2014 at 9:59 pm
Thanks for the help.
I’m getting this error:
alternatives –set jar /opt/jdk1.7.0_67/bin/jar
/opt/jdk1.7.0_67/bin/jar has not been configured as an alternative for
jar
The command to do the same for javac worked though.
REPLY TO AZIMAZIM
October 8, 2014 at 7:50 am
You did not mention where do we have to update the JAVA_HOME ,
JRE_HOME and PATH variable…
KUSHAL PALLI
16. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 16/24
REPLY TO KUSHALKUSHAL PALLI
October 13, 2014 at 9:09 am
when formate namenode it is showing following :
java.net.UnknownHostException and when jps it only showing
Namenode jobtracker secondary namenode,datanode and
tasktracker is missing.
please tell me what are the steps to resolve this issue.
thanks in advance.
REPLY TO CHARLESCHARLES
October 15, 2014 at 3:56 am
On step 2 you missed a hyphen. It should be… “tar -xzf”
REPLY TO YOESOFFYOESOFF
November 4, 2014 at 7:39 am
worderfull, easy to follow and works. thanks your article save my
time
REPLY TO TABRUNETABRUNE
December 13, 2014 at 6:05 am
You really helped me out with this tutorial! Thanks!
REPLY TO SURESHSURESH S
December 13, 2014 at 11:30 am
REPLY TO RAHULRAHUL
October 16, 2014 at 7:10 pm
Hi Charles,
Hyphen is not necessory here… I hope “tar xzf” will also
work…
Please try and confirm if it works for you…
17. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 17/24
Thankyou So much!!
REPLY TO AMBARISHAMBARISH
December 14, 2014 at 7:21 am
Thank you so much. This was very helpful.
REPLY TO FERNANFERNAN
December 21, 2014 at 8:25 pm
thanks was looking for this tutorial
REPLY TO NAGARJUNNAGARJUN
December 31, 2014 at 6:37 am
Hi,
I am trying to install JAVA and Office in Red Hat7 which ever
command if I give it comes No Such Directory File . Please help me is
there any issue.
REPLY TO SAYAMSAYAM
January 4, 2015 at 7:25 am
Hii Rahul.
Thanks for share this wonderful topic .I have downloaded java as ur
instruction.but when i’m going to extract that,i’m getting some
error…i.e
[root@[-a opt]# cd /opt/
[root@[-a opt]# ls
jdk1.7.0_72
jdk-7u72-linux-i586.tar.gz?
AuthParam=1420296787_4405d9335989d1fc6e7df03f0d76c381
jdk-7u72-linux-x64.tar.gz?
AuthParam=1420273038_bb9a14b7dc51ed48b49522bb2b5b6680
wget-log
[root@[-a opt]# tar xzf jdk-7u72-linux-x64.tar.gz
tar: jdk-7u72-linux-x64.tar.gz: Cannot open: No such file or directory
18. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 18/24
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
i’m getting these errors…plz help me Rahul…plz…
REPLY TO DOMÈNECDOMÈNEC
January 5, 2015 at 12:28 pm
Hi Rahul, this is just to say I am migrating an old CentOS 4 to CentOS
6 as an occasional sysadmin (I am a software architect) and all the
tips in your blog have worked great so far, thanks.
REPLY TO ABDOULLAHABDOULLAH TARI JOUTI
January 8, 2015 at 10:43 am
hank you =3 a lot for your sweet and forward article.
REPLY TO MICAELMICAEL
January 16, 2015 at 7:12 pm
Hello !!!
New on Redhat….
My problem is that I can’t get this command “java -version” to work
REPLY TO RAHULRAHUL
January 4, 2015 at 8:37 am
It looks downloaded file is created with name jdk-7u72-
linux-x64.tar.gz?
AuthParam=1420273038_bb9a14b7dc51ed48b49522bb2b5b6680.
So rename file first before extracting
# mv jdk-7u72-linux-x64.tar.gz?
AuthParam=1420273038_bb9a14b7dc51ed48b49522bb2b5b6680
jdk-7u72-linux-x64.tar.gz
# tar xzf jdk-7u72-linux-x64.tar.gz
19. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 19/24
after installation according to description above…
I got a nice download done, but install failed somewhere here at the
end of commands…:
I have this release of Redhat:
[root@docutv etc]# cat redhat-release
Red Hat Enterprise Linux Server release 6.6 (Santiago)
or maybe even bettwer like this
[root@docutv /]# yum version
Loaded plugins: product-id, refresh-packagekit, subscription-
manager
Installed: 6Server/ppc64
1226:3a2b2ccb8c91fdd603df3f3ea4aedb6a7a0f8a91
Group-Installed: yum 15:22a4df6bb11e577f2c2c00cdd8113bfaac3fc27b
version
[root@docutv jdk1.7.0_72]# alternatives –config java
There is 1 program that provides ‘java’.
Selection Command
———————————————–
*+ 1 /opt/jdk1.7.0_72/bin/java
Enter to keep the current selection[+], or type selection number: 1
[root@docutv jdk1.7.0_72]# pwd
/opt/jdk1.7.0_72
[root@docutv jdk1.7.0_72]# alternatives –install /usr/bin/jar jar
/opt/jdk1.7.0_72/bin/jar 2
[root@docutv jdk1.7.0_72]# alternatives –install /usr/bin/javac javac
/opt/jdk1.7.0_72/bin/javac 2
[root@docutv jdk1.7.0_72]# alternatives –set jar
/opt/jdk1.7.0_72/bin/jar
[root@docutv jdk1.7.0_72]# alternatives –set javac
/opt/jdk1.7.0_72/bin/javac
[root@docutv jdk1.7.0_72]# java -version
-bash: /usr/bin/java: cannot execute binary file
20. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 20/24
[root@docutv jdk1.7.0_72]# export JAVA_HOME=/opt/jdk1.7.0_72
[root@docutv jdk1.7.0_72]# export JRE_HOME=/opt/jdk1.7.0_72/jre
[root@docutv jdk1.7.0_72]# export
PATH=$PATH:/opt/jdk1.7.0_72/bin:/opt/jdk1.7.0_72/jre/bin
[root@docutv jdk1.7.0_72]# java -version
-bash: /usr/bin/java: cannot execute binary file
[root@docutv jdk1.7.0_72]#
Thx in advance for help — Micael
REPLY TO KAMILKAMIL
February 4, 2015 at 4:47 pm
I had old java6 installed:
# java -version
java version “1.6.0_41”
Java(TM) SE Runtime Environment (build 1.6.0_41-b02)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)
so I’ve installed java7 as mentioned above, and:
[root@eng-57-sp3 ~]# alternatives –config java
There are 2 programs which provide ‘java’.
Selection Command
———————————————–
* 1 /usr/java/default/java
REPLY TO RAHULRAHUL
January 19, 2015 at 4:56 am
Hi Miceal,
Have you executed below command in step #2
alternatives –install /usr/bin/java java
/opt/jdk1.7.0_72/bin/java 2
21. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 21/24
+ 2 /opt/jdk1.7.0_75/bin/java
Enter to keep the current selection[+], or type selection number:
however java -version still claims (even after reboot):
# java -version
java version “1.6.0_41”
Java(TM) SE Runtime Environment (build 1.6.0_41-b02)
Java HotSpot(TM) 64-Bit Server VM (build 20.14-b01, mixed mode)
what is wrong?
REPLY TO ABHISHEKABHISHEK
March 26, 2015 at 5:39 am
Thanks. Your tutorial helped.
REPLY TO TIAGOFTIAGOF
April 20, 2015 at 3:37 pm
thx a lot! great tut :)
REPLY TO BHUSHANBHUSHAN
April 28, 2015 at 4:50 pm
very neatly written tutorial….probably you can add the java path
,bins to profile file so that u get it working for other user/evrey time u
login
ex:
root@sandlwoodtree:~# tail -3 /etc/profile
export JAVA_HOME=/opt/jdk1.7.0_79
export JRE_HOME=/opt/jdk1.7.0_79/jre
export PATH=$PATH:/opt/jdk1.7.0_79/bin:/opt/jdk1.7.0_79/jre/bin
root@sandlwoodtree:~#
thanks for posting this…It helped me. :)
REPLY TO VIJAYVIJAY
22. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 22/24
REPLY TO CHETANCHETAN
May 13, 2015 at 11:37 am
bash: /usr/bin/java: cannot execute binary file
Please help me out..
REPLY TO SHASHANKSHASHANK
June 2, 2015 at 8:05 am
May 28, 2015 at 12:46 pm
How to update my java version from 31 to 45?
REPLY TO RAHULRAHUL
June 1, 2015 at 4:22 pm
Hi Vijay,
Do you not need specific java version 7u45 ?
REPLY TO VIJAYVIJAY
June 25, 2015 at 7:56 am
Dear Rahul,
i just want to know update my java
version, can u pls help me out from that?
RAHUL
June 26, 2015 at 9:37 am
Hi Vijay,
You can use this article to update
java version without any issue. Let
me know in case any issue occurs.
23. 1/19/2016 How to Install JAVA 7 (JDK 7u79) on CentOS/RHEL 7/6/5
http://tecadmin.net/stepstoinstalljavaoncentos56orrhel56/ 23/24
Excellent tutorial …. works perfectly………..
REPLY TO MANISHMANISH
June 23, 2015 at 1:08 pm
Brilliant tutorial!
REPLY TO ANANDANAND
July 3, 2015 at 10:46 am
Good post !!
Thanks , It helped me today .
REPLY TO HENRYHENRY
July 6, 2015 at 2:49 am
Many thanks
REPLY TO RICODRICOD
December 31, 2015 at 5:54 pm
Thanks!
Followed step by step, worked flawlessly!
REPLY TO ANANDANAND
January 6, 2016 at 11:02 am
Thanks Rahul, it was extremely helpful to look at various options for
installations.
REPLY TO TONITONI
January 11, 2016 at 12:37 am
Very useful for me.