How To Set Java Home Path?

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/set-java-home-path/
PINTEREST
PINTEREST
INSTAGRAM

Java is popular programming language and framework in the IT industry. There are a lot of applications developed with Java. Java requires Java Development Kit to develop applications. Compiled java applications can run on systems those are install Java Runtime Environment a.k.a JRE. We will look in this post how to set and check JRE or JDK or Java Home Path.

Installation

There are two main different version of JDK and JRE. Original vendor is Oracle which distributes and sets standards of Java. Second is open version of JDK and JRE those are supported by Oracle. In this post we will install open version which named openjdk-9-jre-headless .

Check Java Status

We will look if java path already  set simple running java command which is compiler for Java applications.

Update Locate Database

This is auxiliary operation to use locate openjdk location we update locate database

Find JDK Location

We will look where is JDK located and also get JDK version. This operation can be used Oracle JDK too. Just the jdk directory name will be different.

Set Java Home

As we see there is a lot of output for JDK search we can see that path of JDK is /usr/lib/jvm/java-9-openjdk-amd64  because it is located in usr lib. Now we will set PATH for Java

Make Java Home Persistent

Previous step makes JAVA HOME available for sub shells but if the system is restarted the path will be lost. So we need to make this path definition persistent. There are different methods to make persistent. We will look single and simple one. We will add path definition to the system wide environment definition configuration. This operation requires root privileges.

LEARN MORE  Linux Scheduling Commands With at, atq, atrm and batch Examples

Alternative method without need of root privileges is adding Java home path definition to the normal user bashrc file like below.

RSS
EMAIL
FACEBOOK
FACEBOOK
GOOGLE
GOOGLE
https://www.poftut.com/set-java-home-path/
PINTEREST
PINTEREST
INSTAGRAM

Leave a Reply

Your email address will not be published.