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 Use following step by step instructions to install or update Java. I recommend reading carefully instruction for downloading Java from Linux command line. Downloading Latest Java ArchiveJava 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.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.tar.gz"tar xzf jdk-7u79-linux-x64.tar.gzFor 32 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/7u79-b15/jdk-7u79-linux-i586.tar.gz"tar xzf jdk-7u79-linux-i586.tar.gzNote: 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 AlternativesAfter 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_79/alternatives --install /usr/bin/java java /opt/jdk1.7.0_79/bin/java 2alternatives --config javaThere are 3 programs which provide 'java'. Selection Command
Now you may also required to set up javac and jar commands path using alternatives command. alternatives --install /usr/bin/jar jar /opt/jdk1.7.0_79/bin/jar 2alternatives --install /usr/bin/javac javac /opt/jdk1.7.0_79/bin/javac 2alternatives --set jar /opt/jdk1.7.0_79/bin/jaralternatives --set javac /opt/jdk1.7.0_79/bin/javacCheck Installed Java VersionUse following command to check which version of Java is currently being used by system. java -versionjava version "1.7.0_79" Java(TM) SE Runtime Environment (build 1.7.0_79-b15) Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode) Configuring Environment VariablesMost 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.
# 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 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. You are trying to download Oracle patches like JRE 6, JRE 7, JRE 8, JDK 8, and JDK 11 for Windows and JRE 8 for Mac and the download fails. CauseThis is because you're not logged in to Oracle. To download you should provide your login credentials. ResolutionFollow the steps given below to resolve this issue:
If the issue persists even after following the above-mentioned resolutions, please feel free to contact Support. |