Java, a popular programming language and computing platform, is essential for many software applications and development projects. This article guides you through the process of installing Java 8 (also known as Java SE 8) on CentOS/RHEL 9/8 and Fedora systems. Java 8, while not the latest version, is widely used and sought after for its stability and performance in various enterprise environments.
Step 1: Update Your System
Before proceeding with the installation, it’s good practice to update your system to ensure all existing packages are up to date. Open a terminal and execute the following command:
sudo dnf update
Step 2: Install Java 8
CentOS, RHEL, and Fedora users can install Java 8 using the DNF package manager. The OpenJDK 8 package is available in the default repositories, making installation straightforward.
To install OpenJDK 8, run the following command in your terminal:
sudo dnf install java-1.8.0-openjdk
Step 3: Verify the Installation
After the installation is complete, you can verify it by checking the version of Java installed on your system. Execute the following command:
java -version
The output should display the installed version of Java, which should indicate that Java 8 is installed.
Step 4: Set Java Home Environment Variable
To make Java easily accessible from any location in your system, you should set the JAVA_HOME environment variable. This variable points to the Java installation directory.
- Find the installation path of Java 8 by running:
sudo update-alternatives --config java
Copy the path from the installation you want to use.
- Open the /etc/profile file with your preferred text editor (e.g., nano, vi) and add the following line to set JAVA_HOME:
export JAVA_HOME="/path/to/java-8-openjdk" export PATH=$PATH:$JAVA_HOME/bin
Replace /path/to/java-8-openjdk with the actual path to your Java installation.
- Apply the changes by sourcing the profile file:
source /etc/profile
Step 5: Configure Alternatives
If you have multiple versions of Java installed, use the update-alternatives command to set the default version. To configure Java 8 as the default, execute:
sudo update-alternatives --config java
Select the option for Java 8 when prompted.
Conclusion
You have successfully installed Java 8 on your CentOS/RHEL 9/8 or Fedora system. This setup is essential for running Java applications or developing Java-based software. Remember to check for updates regularly to ensure your Java installation remains secure and stable.
139 Comments
$ wget ‘https://download.oracle.com/otn/java/jdk/8u211-b12/478a62b7d4e34b78b671c754eaaf38ab/jdk-8u211-linux-x64.rpm?AuthParam=1561543343_db87fc4729c3230513c85594dd6ffddd’
$ mv jdk-8u211-linux-x64.rpm\?AuthParam\=1561543343_db87fc4729c3230513c85594dd6ffddd jdk-8u211-linux-x64.rpm
$ sudo rpm -i jdk-8u211-linux-x64.rpm
warning: jdk-8u211-linux-x64.rpm: Header V3 RSA/SHA256 Signature, key ID ec551f03: NOKEY
Unpacking JAR files…
tools.jar…
plugin.jar…
javaws.jar…
deploy.jar…
rt.jar…
jsse.jar…
charsets.jar…
localedata.jar…
$ java -version
java version “1.8.0_211”
Java(TM) SE Runtime Environment (build 1.8.0_211-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.211-b12, mixed mode)
$
URL is throwing Error 403:
wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz”
–2019-05-23 23:40:44– https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
Resolving download.oracle.com… 23.35.182.109
Connecting to download.oracle.com|23.35.182.109|:443… connected.
HTTP request sent, awaiting response… 302 Moved Temporarily
Location: https://edelivery.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz [following]
–2019-05-23 23:40:45– https://edelivery.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz
Resolving edelivery.oracle.com… 23.79.166.37, 2600:1406:1400:69d::366, 2600:1406:1400:690::366
Connecting to edelivery.oracle.com|23.79.166.37|:443… connected.
HTTP request sent, awaiting response… 403 Forbidden
2019-05-23 23:40:45 ERROR 403: Forbidden.
Hi,
Thank you for the detailed instructions. It’s straight forward to perform the manual steps to set a specific java version. I’m trying to perform the same steps in a shell script on CentOS 7. I’. using “expect” to set the specific Java version but no luck. Have you been successful in setting the Java version with “expect” to set the value when executing:
alternatives –config java
This command opens an interactive subshell that requires the user to select a numerical value for the Java version.
function configure_java() {
yum -y install expect
EXPECT=$(which expect)
JAVA_HOME=”
update-alternatives –install /usr/bin/java java ${JAVA_HOME%*/}/bin/java 2000
${EXPECT} <<EOD
spawn update-alternatives –config java
expect "Enter to keep the current selection[\+], or type selection number:"
send 2
EOD
}
However, when listing the JAVA_HOME version it has not been set. When I do it manually JAVA_HOME has the correct java version listed
echo $JAVA_HOME
Any thoughts?
Cheers,
Roland
Since 8u211/212 you need to login to your Oracle account to download JDK, so this method isn’t working anymore.
A new cookie called “OAMAuthnCookie_edelivery.oracle.com:443” is needed for downloading JDK, but the value of this cookie is generated by Oracle when you login.
Yes confirmed, this does not work any longer. Can we update this guide please? Thanks in advance Rahul!
Thanks too much.
Thanks buddy.
Helped alot.
Thank you so much. This is a link that I was recommended. Very kind of you to save us trouble, all those you faced. May all your experience bring you a good fortune.
Thank you once again.
Big thanks
Hello. Does anyone known where is hash in download link comes from?
For example 750e1c8617c5452694857ad95c3ee230
in https://download.oracle.com/otn-pub/java/jdk/8u192-b12/750e1c8617c5452694857ad95c3ee230/jdk-8u192-linux-x64.tar.gz
Hello,
I am getting this error on my RHEL 7.5 server:
alternatives –install /usr/bin/jar jar /usr/local/java/jdk1.8.0_192/bin/jar 2
failed to link /usr/bin/jar -> /etc/alternatives/jar: /usr/bin/jar exists and it is not a symlink
Please help! Thanks!
Bacause of Oracle’s Worst/selfish behaviour not able to download from oracle site. Its too bad even though he bought it. Can you please provide an alternative as you are an expert on all these things and maintaining BlogSpot.
Hi Ravi,
This article has been updated with the latest version and download link. Please check if this helps you.
wget –no-cookies –no-check-certificate –header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.tar.gz” again does not work, yesterday everything was okay. Seems that they ban
Hi Rahul,
I am trying to install jenkins on my centos vm instance but unable to do so as its need java 8 and the java version in my system is 1.7. Now, I am trying to update the java version but due to proxy issue I am getting error so I downloaded the java 8 couple of times “jre-8u181-linux-x64.rpm” and whenever I am trying to execute this rpm file, like below,
sudo yum install jre-8u181-linux-x64.rpm
But I am getting error like below,
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: local. Please verify its path and try again
Could you please navigate me to the correct direction.
Looking forward for your reply.
Regards
Sumit Sahay
Try below command:
sudo yum localinstall jre-8u181-linux-x64.rpm
Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Cannot open: jre-8u181-linux-x64.rpm. Skipping.
Nothing to do
Nice update !
Please fix this:
export PATH=$PATH:/opt/jdk1.8.0_171/bin:/opt/jdk1.8.0_181/jre/bin
it should be 181 in both
Thanks Alamos, tutorial has been updated.
Hi!
When i am trying to execute the below command:
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”
It’s coming with 404 not found HTTP request, can you help me, please?
Very helpful and clearly documented. Thanks Rahul
I just wanted to add that this is very helpful for anyone using SAP Hybris. The system and its Apache Ant builder are very sensitive to Java changes and build paths. Thank you for the content.
nice expalnation its worked for me
nice article
tq
Works like a charm, thank you Rahul!
Fantastic article, thank you!
I’m getting below error when I try java -version command
-bash: /usr/bin/java: cannot execute binary file
Any Solutions?
Try:
chmod +x /opt/jdk1.8.0_161/bin/java
I need to upgrade my Oracle Java 1.7.0_79 to 1.8. Is this above method will work? or is there any other method?
Yes, it will work with Java upgrade also.
Thank you. It is working fine. This article is very helpful. Keep on Posting
Thank you. It helps a lot and working.
Hi Rahul,
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.
Will you please enlighten me.
Please for god’s sake remove the /etc/environment update section…. that’s not correct and it screws up the system
I followed it verbatim and later I saw your comment. Now it is not working and as good as not installed. The .sh file is not running as exe program. Pl how to undo /etc/bashrc.
I followed above steps but unfortunately i cannot edit /etc/environment file now, due to change in this file i am unable to run any command from my user even i cannot run sudo, sudo su or ls chown etc..
I am working on AWS Linux instance.
please help i can access files via ssh and winscp but with no permission to edit.
Reboot from dvd with rescue option, then remove the lines in de environment file.
really VICTO ? how to do this on AWS linux instance? i am unable to see such option on aws
Good tutorial. Thank you!
Thank you, very usefyll!
Thank you. saved lot of time
Download Path incorrect
Even after following the instructions, the java version on my Centos is still at 1.7. I can see the folders for 1.8 are created but ‘java -version’ still returns 1.7. Any reasons?
instructions messed up the root login PATH
subsequent root login gives these errors
Last login: Tue Jan 9 00:45:24 2018 from 116.74.251.1
bash: tty: command not found…
Similar command is: ‘tty’
bash: ls: command not found…
Similar command is: ‘lz’
/usr/libexec/grepconf.sh: line 5: grep: command not found
bash: grep: command not found…
bash: grep: command not found…
bash: uname: command not found…
Found the problem. Last instruction to update /etc/environment messing up login.
Removed the contents of /etc/environment and it works fine.
For generic java 8 I would suggest the following
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
I have same issue but unfortunately i cannot edit /etc/environment file now, due to change in this file i am unable to run any command from my user even i cannot run sudo, sudo su or ls chown etc..
I am working on AWS Linux instance.
please help i can access files via ssh and winscp but with no permission to edit.
After following the instructions, my java version is still at 1.7. It has not changed to 1.8. Any reasons?
crap, it did not work
Hi Ged. What issue are you facing?
This is really saved my time. Thanks!
Please update step 1. to tar xzf jdk-8u151-linux-x64.tar.gz. It still says tar xzf jdk-8u144-linux-x64.tar.gz
Thanks, Shaun to point out… The tutorial has been updated.
Hi!
Apparently it’s going to work yes but i am having a problem with this command:
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/8u152-b01/090f390dda5b47b9b721c7dfaa008135/jdk-8u144-linux-x64.tar.gz” Changed it to the last arquive (152)
It’s coming with 404 not found HTTP request, can you help me, please?
Thank you so much Tecadmin.net! I love this post, THANK YOU!
Thank you for the tutorial it saves a lot of time now.
Thank you! amazing and usefull tutorial! just what i need!.
Its was a great article for java config also had clear approach to solve the install conflicts for Jenkins installation. Thanks a lot I look forward for your future articles.
Thank you very much for this rewarding article! It was worth the try
Hi,
I am not sure what I did wrong while installing java 1.8
I have followed the same steps as mentioned but when checking for JAVA version, it says 1.7.0.67 rather than 1.8.
[root@quickstart jdk1.8.0_131]# java -version
java version “1.7.0_67”
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Hi Jaydeep,
Could you please let me know if you could resolve this? I am stuck at this point and don’t know how to proceed. I believe this is the reason I am not able to proceed with my SparkR set up too and getting the below error:
————————————————–
> sc = sparkR.session(master=’local’)
Spark package found in SPARK_HOME: /home/cloudera/.cache/spark/spark-2.2.0-bin-hadoop2.7
Launching java with spark-submit command /home/cloudera/.cache/spark/spark-2.2.0-bin-hadoop2.7/bin/spark-submit “–conf” “spark.debug.maxToStringFields=100” /tmp/RtmpvEvWZD/backend_port2cd67996e589
Error: Cannot load main class from JAR file:/tmp/RtmpvEvWZD/backend_port2cd67996e589
Run with –help for usage help or –verbose for debug output
Error in sparkR.sparkContext(master, appName, sparkHome, sparkConfigMap, :
JVM is not ready after 10 seconds
Thanks, I needed a way to upgrade Java from the server (command line).
Great article. Worked perfectly
Thank you, these were very especific and easy to follow instructions.
Hello could you explain more specific on what we’re doing on
“Also put all above environment variables in /etc/environment file for auto loading on system boot.” on the last step. /
Hi Team,
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.
Did you solve your problem on this?
Hi Vergi,
Make sure you have included $PATH: in command like
export PATH=$PATH:
I don’t understand the Setup “Install Java with Alternatives”???.?
Thanks man!
Thank you very much!
Used this to install it on 32 bit CEntos 6.5 successfully, great work!
Thank you so much.
Hi. From I run this commands:
echo “export JAVA_HOME=/opt/jdk1.8.0_51” > /etc/profile.d/jre.sh
echo “export JRE_HOME=/opt/jdk1.8.0_51/jre” >> /etc/profile.d/jre.sh
echo “export PATH=$PATH:/opt/jdk1.8.0_51/bin:/opt/jdk1.8.0_51/jre/bin” >> /etc/profile.d/jre.sh
I am getting this when I open the terminal
bash: $’\342\200\234export’:order not found
bash: $’\342\200\234export’: order not found
bash: $’\342\200\234export’: order not found
[evconsul8@localhost ~]$
How this could affects?
Thanks a lot
See if you have a JRE.SH on /etc/profile.d
I had this one and was point to a old java version. Just deleted and is working fine.
1. Remove your jre.sh via rm /etc/profile.d/jre.sh
2. Use these commands to correctly export variables:
echo ‘export JAVA_HOME=”/opt/jdk1.8.0_111″‘ >> /etc/profile.d/jre.sh
echo ‘export JRE_HOME=”/opt/jdk1.8.0_111″‘ >> /etc/profile.d/jre.sh
echo ‘export PATH=”$PATH:/opt/jdk1.8.0_111/bin:/opt/jdk1.8.0_111/jre/bin”’ >> /etc/profile.d/jre.sh
Reboot the machine and you’ll be fine.
Hi. From I run this commands:
echo “export JAVA_HOME=/opt/jdk1.8.0_51” > /etc/profile.d/jre.sh
echo “export JRE_HOME=/opt/jdk1.8.0_51/jre” >> /etc/profile.d/jre.sh
echo “export PATH=$PATH:/opt/jdk1.8.0_51/bin:/opt/jdk1.8.0_51/jre/bin” >> /etc/profile.d/jre.sh
I am getting this when I open the terminal
bash: $’\342\200\234export’:order not found
bash: $’\342\200\234export’: order not found
bash: $’\342\200\234export’: order not found
[evconsul8@localhost ~]$
How this could affects?
Thanks a lot
Works perfectly as is. Put your env. vars in $HOME/.bashrc (if bash is the preferred shell). And you are all set.
Thanks , Seguí estos pasos en un sistema operativo oracle Linux y todo fue correcto muchas gracias me ahorro mucho tiempo
Hi, this is an amazing post, and I benefited a lot ! But I met a problem. After installing, i checked the version and it was successful. However, I wanted to use the java 1.8 on system boot, and as you suggested I put the last three commands in the “/etc/environment” file. However, after I did that, my machine is not starting (my machine is a CentOS machine created with Cloudera training vm with help of virtualbox), and giving the following error:
Starting jexec servicesDevice, “eth0” does not exist
Do you know what is wrong ? Can you please reply ? Thanks !
Could any one advise on how to sort out the envionment paths properly on Centos 7? Putting them as written in the article in /etc/environment messes up the path meaning normal commands are missing from /bin/.
Yes I also have this issue.
Thank you. This article was really helpful.
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.
It was the line with “$PATH” that had spoiled /etc/environment.
I used a command “/bin/sudo mc” to edit /etc/environment again and fix the problem.
Thanks for the awesome instructions! I ran into one issue that someone else may have already mentioned, but I did not see it. On ubuntu Alternatives has been replaced with update-alternatives. hope that saves someone a minute or two.
Thanks
Thanks Great Tutorial.Perfect
This is a very good article. Concise and proper steps to setup java on any Linux box. Make a shell script with all the above commands and run it every-time you need to setup java
This was rather useful, thank you
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).
Helped me in setting up on linode VPS when all other tutorials failes. Simple, hats off rahul
Excellent nicely explained the steps. thanks.
Now, you have to change: download.oracle.com by edelivery.oracle.com
Hi Ademian,
Yes edelivery.oracle.com is also working but it still redirecting (302) to download.oracle.com.
I tried on ubuntu 14 and it worked.
only deviation”
I wrote
export JAVA_HOME=/opt/jdk1.8.0_66
export JRE_HOME=$JAVA_HOME/jre
export PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
into ~/.profile
Install is the easy part, but can anyone note the reason why you can no longer perform a “yum update jdk” with version 1.8. I have noticed that once the package is installed, the package name format is different than in versions 1.7 and 1.6.
Where 1.7 was formatted like so: jdk-1.7.0_80
Version 1.8 is now formatted like this: jdk1.8.0_60
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,
For me, putting the “export PATH” stuff in /etc/environment causes all users to get thrown out when logging into the GUI.
Instead, do this:
echo “export JAVA_HOME=/opt/jdk1.8.0_51” > /etc/profile.d/jre.sh
echo “export JRE_HOME=/opt/jdk1.8.0_51/jre” >> /etc/profile.d/jre.sh
echo “export PATH=$PATH:/opt/jdk1.8.0_51/bin:/opt/jdk1.8.0_51/jre/bin” >> /etc/profile.d/jre.sh
Hi Mark,
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 ?
So that i can apply the changes suggested in your post.
Hi,
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.
To recover do the following:
1. Ctl-Alt-F2 to switch to a command line console
2. Login with your account details – you’ll get errors as the shell script runs but don’t worry for the moment
3. Enter the command PATH=$PATH:/bin
4. Enter the command startx
5. Once the desktop appears open a terminal session
6. Enter the command su –
5. Enter your root password at the prompt
6. Again, enter PATH=$PATH:/bin
7. Enter the command gedit /etc/environment
8. Delete all lines in the file and save
9. Restart Centos
Best regards…Paul
Thank a lot Paul
Hi, i messed up my centos 6 machine. i have the same problem. but i try to do what you have explained here, the instruction # 4 does not work. it says -bash: comand not found.
am really having a terrible time
Hi everyone I would to know how resolve this:
bash: $’\342\200\234export’: order not found
bash: $’\342\200\234export’: order not found
bash: $’\342\200\234export’: order not found
[evconsul8@localhost ~]$
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
I cannot install to Centos 6.X.
I got the following error message:
# java -version
-bash: /usr/bin/java: cannot execute binary file
It is file permission problem or something else?
Hi Peter,
Did you executed alternatives commands properly ?
I cannot install to Centos 6.X. even I executed alternatives cmd properly
I got the following error message:
# java -version
-bash: /usr/bin/java: cannot execute binary file
nice, not sure about export part but rest is helpfull
Thanks a lot
export PATH=$PATH:/opt/jdk1.8.0_45/bin:/opt/jdk1.8.0_45/jre/bin
Also put all above environment variables in /etc/environment file for auto loading on system boot.
export is not working, when you put it in /etc/environment file
export is shell command and /etc/environment process only static variables
variable=value
I followed yout guifr but I didn’t manage to install Java on my server so I asked my hosting provider (RoseHosting)to install Java for me. Thank you.
I tried to install on a RHEL5.10 server, but I got error when I checked the java version
java –version
Unrecognized option: –version
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
Please help!
HI Felix,
Make sure you are using single hyphen ( – ) with option -version.
Work …centos 6.6
can any one tell me what exactly “alternatives” command doing here.
Followed the instructions and it worked like a charm. Thanks much Rahul.
Hi Admin,
I have followed your steps but getting following error when running command ‘java -version’
-bash: /usr/bin/java: /lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
Hey Tapas,
You have downloaded wrong java archive as your system architecture. Check your system architecture using command below and download correct java archive.
a little late, but for anyone having this error maku sure you used the sudo command, so:
sudo 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/8u77-b03/jdk-8u77-linux-x64.tar.gz”
Working nice…. thanks for easy steps…..
Following these instructions on CentOS 6 I get this error:
/lib/ld-linux.so.2: bad ELF interpreter: No such file or directory
Hi Jonathan,
You have downloaded wrong java archive as your system architecture. Check your system architecture using command below and download correct java archive.
uname -m
Following these instructions on CentOS 6 I get this error:
http://tecadmin.net/install-java-8-on-centos-rhel-and-fedora/
Hello sir, Im trying to install the latest java on my VPS to run a simple .jar file and the 1st step “tar xzf jdk-8u25-linux-x64.tar.gz” returns
# tar xzf jdk-8u25-linux-x64.tar.gz
tar (child): jdk-8u25-linux-x64.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
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.
Thank you for this clear, easy-to-follow guide! With it I quickly installed Java 8 update 25.
Thanks Kent
Yo no pude usar el mismo comando y use este “update-alternatives” y solo así pude lograrlo.
Thanks alot i used it to install it on 32 bit CEntos 6.5 successfully.
WHen i tried to set up the environment variables . I got no report whatsoever after running your code. Hope i got it correctly?
This work… thanks a lot
This is a great concise article, working fine to centOs 6.5, thanks a lot.
This is a great concise article. Thank you.
you can append `-O jdk-8u25-linux-x64.tar.gz` to your wget line so that it renames it appropriately.
This helped me with RedHat Linux 6. Thank you!
Thanks for the instructions first. I followed all the steps on CentOS. However, I got No such file or directory after typing “java -version”. Any idea what might have caused it?
Ying, I had the same issue. I followed the steps exactly but when I tried to test that it was working I kept getting “No such file or directory”. I tried another version of java with the same results. Finally I traced it to (I think) to the alternative command. It seems it could not creating the symbolic link correctly between “/etc/alternatives” and “/opt/jdk1.8.0_45/bin/java”.
I deleted the existing link “”/etc/alternatives/java” and then recreated it:
ln -s /opt/jdk1.8.0_45/bin/java java
and now the command “java -version” displays:
java version “1.8.0_45”
Java(TM) SE Runtime Environment (build 1.8.0_45-b14)
Java HotSpot(TM) Server VM (build 25.45-b02, mixed mode)
Thanks a lot, very useful article. 🙂
Great article thanks
Working fine to centOs 6.5, thanks a lot.
This work for Fedora 20?
Thank you so much Rahul Kumar……. 🙂 This article is the best article that I found.
Thank you so much.
Maybe useful for other readers:
– On a vanilla fedora (or at least on my system), ‘alternatives’ doesn’t seem to be in the path, so the full path has to be specified:
sudo /usr/sbin/alternatives –install /usr/bin/java java /opt/jdk1.8.0_05/bin/java 2
sudo /usr/sbin/alternatives –config 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
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
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.
Hello sir, Im trying to install the latest java on my VPS to run a simple .jar file and the 1st step “tar xzf jdk-8u25-linux-x64.tar.gz” returns
# tar xzf jdk-8u25-linux-x64.tar.gz
tar (child): jdk-8u25-linux-x64.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
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.
Hi Jay,
It looks jdk-8u25-linux-x64.tar.gz is not available at current directory. Make sure the file exists there with correct name.
Hi Rahul,
I am trying to install jenkins on my centos vm instance but unable to do so as its need java 8 and the java version in my system is 1.7. Now, I am trying to update the java version but due to proxy issue I am getting error so I downloaded the java 8 couple of times “jre-8u181-linux-x64.rpm” and whenever I am trying to execute this rpm file, like below,
sudo yum install jre-8u181-linux-x64.rpm
But I am getting error like below,
Trying other mirror.
Error: Cannot retrieve repository metadata (repomd.xml) for repository: local. Please verify its path and try again
Could you please navigate me to the correct direction.
Looking forward for your reply.
Regards
Sumit Sahay