Core Linux

How to Install JAVA JDK on Linux or cPanel Server?

Most of the developers use Linux as their operating system. Java is a popular programming language developed by Oracle-Sun. The Java JDK is a development environment for building applications, applets, and components using the Java programming language from Oracle Technology Network.

In order to install Java JDK on your Linux or cPanel server you can follow the below steps:

Download the intended version of Java JDK from oracle, if your Linux server fulfills all the prerequisites of the selected version of JDK from the below link

http://www.oracle.com/technetwork/java/javase/downloads/index.html

Create a directory /usr/java and download java JDK tar in it.

Like in our case  we have downloaded jdk-7u11-linux-x64.gz  and uploaded it to /usr/java directory

Extract the contents in jdk-7u11-linux-x64.gz

root@centos [/usr/java]# tar -xzvf jdk-7u11-linux-x64.gz

You will get a directory such as “jdk1.7.0_11?

Now, let’s set the JAVA_HOME path. To do this add lines like below to the .bash_profile.

root@centos [/usr/java]# vi ~/.bash_profile

export JAVA_HOME=/usr/java/jdk1.7.0_11
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:$JAVA_HOME/bin

The path /usr/java/jdk1.7.0_11 may get changed depending upon the version of JDK you choose to download and the directory where you extract the installation.

Once the .bash_profile is configured, now to set the environment variables that you have just configured using the below command

root@centos [/usr/java]# source ~/.bash_profile

To Verify new settings use the following commands:

root@centos [/usr/java]# echo $JAVA_HOME
/usr/java/jdk1.7.0_11

root@centos [/usr/java]# echo $PATH
/usr/java/jdk1.7.0_11/bin:/usr/java/jdk1.7.0_11/bin:/usr/local/jdk/bin:/usr/kerberos/sbin:
/usr/kerberos/bin:/usr/lib/courier-imap/sbin:/usr/lib/courier-imap/bin:/usr/local/sbin:
/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:=/usr/java/jdk1.7.0_11/bin:/usr/local/bin:
/usr/X11R6/bin:/root/bin:/usr/java/jdk1.7.0_11/bin:/usr/java/jdk1.7.0_11/bin

 

To Set JAVA_HOME / PATH for all the user’s edit /etc/profile this will install java jdk global config

root@centos [/usr/java]# vi /etc/profile

export JAVA_HOME=/usr/java/jdk1.7.0_11
export PATH=$JAVA_HOME/bin:$PATH
export PATH=$PATH:$JAVA_HOME/bin

Save and close the file. Once again you need to type the following command to activate the path settings immediately:

root@centos [/usr/java]# source /etc/profile

Now check the java JDK version as follows

root@centos [/usr/java]# java -version
java version “1.7.0_11?
Java(TM) SE Runtime Environment (build 1.7.0_11-b21)
Java HotSpot(TM) 64-Bit Server VM (build 23.6-b04, mixed mode)

I hope the above steps will help you in downloading and installing java JDK on a Linux server. If you still face any issues, please connect us at support@Hostripples.in


Cyril Chakranarayan
Cyril Chakranarayan - I love Travelling, Riding Bikes, and Reading. I am a passionate technology seeker and love to explore continuously evolving technology especially in the Cyber World, Working in the Web Hosting Industry for 10 years.

Recent Posts

Discover the SEO Trends That Will Define 2025

Hold onto your keyboards, fellow digital enthusiasts! The future of SEO is racing towards us faster than a Google algorithm…

2 days ago

The Ultimate Beginner’s Playbook for Instagram Marketing

What Is Instagram Marketing? Instagram Marketing includes using the platform to advertise your business or personal brand to increase visibility,…

1 week ago

The Ultimate Guide to DIY Website Builders for Entrepreneurs

Ah, the joys of building a website! Picture this: You're sitting there in your pajamas, coffee in hand, ready to…

3 weeks ago

Don’t Ignore These 11 Signs You Need a Hosting Upgrade

Are you feeling like your website is running in slow motion? It can be frustrating when your online presence doesn't…

4 weeks ago

PrestaShop vs OpenCart: Which Is Right for Your Business?

Are you ready to take your online store to the next level? Whether you're running a PrestaShop or OpenCart platform,…

1 month ago