How VPS - How to use/setup VPS
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
  • Home
  • Management guides
    • Web servers software
      • Directadmin
      • Hocvps Script
      • Centmin Mod
      • CWP
      • Kloxo-MR
      • Plesk
    • Control Panels
    • Securing VPS/Servers
      • SSL Certificates
      • Upgrading
      • Authentication
  • Operating System
    • CentOS
    • Fedora
    • Debian
    • Linux
    • Arch
    • BSD
    • CoreOS
  • Reviews
  • Coupon
    • Domain Coupon
    • Hosting Coupon
No Result
View All Result
How VPS - How to use/setup VPS
No Result
View All Result
Home Operating System CentOS

Install Java SE on CentOS

How VPS by How VPS
October 1, 2019
in CentOS
0
0
SHARES
5
VIEWS
Share on FacebookShare on Twitter

Contents

  1. Introduction
  2. Prerequisites
  3. Notice
  4. Installing OpenJDK 8 packages
  5. Installing OpenJDK 7 packages
  6. Installing OpenJDK 6 packages
  7. Installing Oracle Java 8 packages
    1. JRE
    2. Server JRE
    3. JDK
  8. About Oracle Java 7 and Oracle Java 6 packages
  9. Checking installation result
  10. Setting up environment variables
  11. Want to contribute?


Introduction

Java is a popular software platform that lets you develop and run Java applications and applets in various hardware environments.

There are three editions of the Java platform: Standard Edition (SE), Enterprise Edition (EE), and Micro Edition (ME). We will only talk about the Standard Edition (SE) of Java in this article.

There are also two different implementations of the Java SE platform: OpenJDK and Oracle Java. The source code of each implementation is almost the same, only several minor differences exist between them. In short, OpenJDK is fully open source and primarily GPL-licensed while Oracle Java adds some closed source third party components and some commercial features, using a commercial license – Binary Code License for Java SE Platform Products.

Besides, there are two different packages for each implementation of Java: Java Runtime Environment (JRE) and Java Development Kit (JDK). JRE is necessary for running compiled Java applications while JDK is used for developing Java applications.

Meanwhile, each implementation of Java SE has three widely-used version numbers (6, 7, and 8) for various kinds of applications.

For Oracle Java, the software packages can be 32-bit (i686, x86) or 64-bit (x64).

When installing Java SE, you need to pick the appropriate combination of the factors mentioned above, according to the requirements of your applications and licenses.

Prerequisites

All the commands in this tutorial are to be run by a non-root user with sudo privileges. You need to create such a user according to this article.

Notice

Usually, you just need to install only one of the following variants, but the design of Java allows you to install two or more variants on your system. After installation, you should also set up several environment variables for daily use. It also helps to setup the default Java program when you have multiple variants installed on your system. Instructions are provided later in this tutorial.

Installing OpenJDK 8 packages

JRE: sudo yum install -y java-1.8.0-openjdk

JDK: sudo yum install -y java-1.8.0-openjdk-devel

Installing OpenJDK 7 packages

JRE: sudo yum install -y java-1.7.0-openjdk

JDK: sudo yum install -y java-1.7.0-openjdk-devel

Installing OpenJDK 6 packages

JRE: sudo yum install -y java-1.6.0-openjdk

JDK: sudo yum install -y java-1.6.0-openjdk-devel

Installing Oracle Java 8 packages

Unlike OpenJDK, Oracle Java packages should be downloaded onto your system before you can install them.

There are three different packages of Oracle Java 8: JRE, Server JRE, and JDK. Among these packages, Server JRE package is for running Java applications on the server, the other two are used in the same way as their OpenJDK peers.

If possible, you should always download and install the latest version of Oracle Java, which is 8u66 at the time of writing. You can always find the latest version and its download URL on the Oracle Java official website.

Other installation options include: CPU types (i686 or x64) and download file types (.rpm or .tar.gz).

JRE

cd ~
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/8u66-b17/jre-8u66-linux-x64.rpm"
sudo yum localinstall -y jre-8u66-linux-x64.rpm
rm ~/jre-8u66-linux-x64.rpm

Note: If a newer version is released, replace the URL and the file name accordingly with the latest info on the Oracle website.

Server JRE

cd ~
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/8u66-b17/server-jre-8u66-linux-x64.tar.gz"
sudo mkdir /usr/java/
sudo tar -zxvf server-jre-8u66-linux-x64.tar.gz -C /usr/java/
rm ~/server-jre-8u66-linux-x64.tar.gz

Note: If a newer version is released, replace the URL and the file name accordingly with the latest info on the Oracle website.

Before you can use Java, you need to set up several environment variables:

sudo vi /etc/profile

Add the following sentences to the end of the file:

export JAVA_HOME=/usr/java/jdk1.8.0_66
export JRE_HOME=/usr/java/jdk1.8.0_66/jre
export PATH=$PATH:/usr/java/jdk1.8.0_66/bin

Save and quit:

:wq

Put your changes into effect:

source /etc/profile

JDK

cd ~
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/8u66-b17/jdk-8u66-linux-x64.rpm"
sudo yum localinstall -y jdk-8u66-linux-x64.rpm
rm ~/jdk-8u66-linux-x64.rpm

Note: If a newer version is released, replace the URL and the file name accordingly with the latest info on the Oracle website.

About Oracle Java 7 and Oracle Java 6 packages

The security updates of Oracle Java 7 and Oracle Java 6 have been unavailable to the public for a while now. It’s not recommended to continue the use of Oracle Java 7 or Oracle Java 6 without these security updates. If you are obligated to maintain an incompatible-to-Oracle-Java-8 legacy Java 7 or Java 6 application, you need to contact Oracle for further support.

Checking installation result

java -version

If your installation is OK, you will see a prompt like:

java version "1.8.0_66"
Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

Setting up environment variables

Whichever variant you have installed, you should set up the following environment variables for daily use. When multiple variants have been installed on your system, you can also specify the default Java program with the following method:

sudo vi /etc/profile

Add the following sentences to the end of the file. Replace /usr/java/jdk1.8.0_66 with the install location on your server:

export JAVA_HOME=/usr/java/jdk1.8.0_66
export JRE_HOME=/usr/java/jdk1.8.0_66/jre
export PATH=$PATH:/usr/java/jdk1.8.0_66/bin

Save and quit:

:wq

Put your changes into effect:

source /etc/profile

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article
How VPS

How VPS

Related Posts

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

February 25, 2022
How to Install BoltWire CMS on CentOS 7
CentOS

How to Install BoltWire CMS on CentOS 7

February 14, 2020
Showterm.io – A Terminal/Shell Recording, Upload and Share Tool for Linux
CentOS

Setup HTTP Authentication With Nginx on CentOS 7

February 14, 2020
Next Post

How to Setup a WebDAV Server Using Apache on CentOS 7

Install DirectAdmin on CentOS 6 or 7

How To Install a Mumble Server on CentOS 7

Leave a Reply Cancel reply

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

Follow Us

  • 121 Followers
  • 87.2k Followers

Recommended

How to Install ResourceSpace on CentOS 7

3 years ago

How to Install ImpressPages CMS 5.0 on a Fedora 26 LAMP VPS

3 years ago

Easily Correct a Typo of Previous Command Using Carat (^) Symbol

4 years ago

Check Internet Speed With Speedtest-cli on CentOS

3 years ago

Instagram

    Please install/update and activate JNews Instagram plugin.

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

Topics

Apache Web Server Bluehost Review 2019 Bluehost Review 2020 Bluehost Review 2021 Centmin Mod CentminMod centos install htop fsck htop install HTTP DoS attack Install Snort on an Ubuntu install Zabbix on CentOS install Zabbix on CentOS 7 Linux Commands linux guide linux install htop linux vps setup guide MariaDB MariaDB Error Mysql mysqld error optimize MariaDB optimize Mysql snort Ubuntu
No Result
View All Result

Highlights

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Webmin Reviews

Virtualmin Reviews

CentOS Web Panel Reviews

Ajenti Reviews

ISPConfig Reviews

Trending

Failed to download metadata for repo 'appstream' on Centos 8
CentOS

How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8

by How VPS
February 25, 2022
0

I tried to update some extensions by use yum on centOs which I specified in Dockerfile. After...

How to Fix MySQL Error "Plugin 'InnoDB' registration as a STORAGE ENGINE failed"?

How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”?

November 17, 2020
How to optimize Mysql or MariaDB

How to optimize Mysql or MariaDB

November 3, 2020
Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

Top Free Web Hosting Control Panels To Manage VPS/Dedicated Servers

February 17, 2020
Webmin Reviews

Webmin Reviews

February 17, 2020
How VPS – How to use/setup VPS

We bring you the best Premium WordPress Themes that perfect for news, magazine, personal blog, etc. Visit our landing page to see all features & demos.
LEARN MORE »

Recent News

  • How to fix error: Failed to download metadata for repo ‘appstream’ on Centos 8 February 25, 2022
  • How to Fix MySQL Error “Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed”? November 17, 2020
  • How to optimize Mysql or MariaDB November 3, 2020

Categories

  • Arch
  • Authentication
  • Backups
  • BSD
  • Centmin Mod
  • CentOS
  • Control Panels
  • CoreOS
  • CWP
  • Debian
  • Directadmin
  • Encryption
  • Fedora
  • Firewalls
  • Hocvps Script
  • Hosting providers
  • Kloxo-MR
  • Linux
  • Mitigations
  • Operating System
  • Plesk
  • Reviews
  • Securing VPS/Servers
  • Security Patches
  • SSL Certificates
  • Uncategorized
  • Upgrading
  • VPS/Servers management guides
  • Vulnerability Detection
  • Web servers software
  • Webhosting Control Panel

[mc4wp_form]

© 2018 JNews - City News Magazine WordPress theme. All rights belong to their respective owners.
JNews is a top selling 2018 WordPress News, Blog, Newspaper & Magazine Theme.

No Result
View All Result
  • Home

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.