Home / ENGLISH / Linux System / [Solved] How to install Java 7 on Centos and Redhat 6/7

[Solved] How to install Java 7 on Centos and Redhat 6/7

Linux – [Solved] How to install Java 7/8 on Centos and Redhat 6/7

How to install Java 7 on Centos and Redhat 6/7

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.

we will download tar.gz file. You can also install with bin file.

For 64 Bit:-

For 32 Bit:-

Note: If Above wget command doesn’t not work for you. You can download from Official page and upload to your server by TFTP/FTP

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.

Now you may also required to set up javac and jar commands path using alternatives command.

Check Installed Java Version

Use following command to check which version of Java is currently being used by system.

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
    • Setup JRE_HOME Variable
    • Setup PATH Variable
 

Note : IMPORTANT

You can config Environment Variables in file /etc/environment (with me, i used this way to make sure Java works well)

 (open /etc/enviroment and add 3 lines

JAVA_HOME=/opt/jdk1.7.0_79

About Hoang Do Viet

Tớ thích thể thao, văn thơ, ghét IT như quỷ ý ......

Check Also

How to fix error PYCURL ERROR 7 – Failed to connect to .. on Vmware Workstation Centos

Tuhocmang.com – [Discuss]: How to fix error PYCURL ERROR 7 – “Failed to connect to ..” …

Leave a Reply

Your email address will not be published. Required fields are marked *