Saturday 12, Apr 2025
We are moved to new domain
Click -> www.ehowtonow.com
Saturday, 23 September 2017

Java Environment Setup in Linux Ubuntu with apt-get

This article explains about how to setup Java in Linux Ubutu operating system. To setup Java in Windows environment follow instruction given in following link Java Environment Setup in Windows

Install Java

First of all, you need to add webupd8team Java PPA repository in your system. After that install, Oracle Java 8 using following a set of commands.
$ sudo add-apt-repository ppa:webupd8team/java
$ sudo apt-get update
$ sudo apt-get install oracle-java8-installer

Verify Installed Java Version

After successfully installing Oracle Java using above step verify installed version using the following command.
$ java -version 
java version "1.8.0_144"
Java(TM) SE Runtime Environment (build 1.8.0_144-b01)
Java HotSpot(TM) 64-Bit Server VM (build 25.144-b01, mixed mode)

Java Environment Variable 

Also, install Java configuration package. It seems like below package is already installed with latest operating systems during installation of JAVA packages. But you can still make sure by running below command.
$ sudo apt-get install oracle-java8-set-default
Now add the JAVA_HOME and JRE_HOME environment variable in /etc/environment configuration file using following command.
$ cat >> /etc/environment <<EOL
JAVA_HOME=/usr/lib/jvm/java-8-oracle
JRE_HOME=/usr/lib/jvm/java-8-oracle/jre
EOL

Test it by executing:

echo $JAVA_HOME
If it returns the just set path, the environment variable has been set successfully. If it doesn't, please make sure you followed all steps correctly.

Shop and help us

Flipkart Offer Snapdeal offer Amazon.in offer Amazon.com offer

Related Posts:

  • Java Directory Examples How to Create Directory How to retrieve all the files from Directory How to search file from directory How to retrieve all the files from Directory using File.listFiles() How to retrieve all the directory names How to retr… Read More
  • How to delete directory using Java boolean java.io.File.delete() Deletes the file or directory denoted by this abstract pathname. If this pathname denotes a directory, then the directory must be empty in order to be deleted. Note that the java.nio.file.Fil… Read More
  • How to check directory or file is hidden using Java boolean java.io.File.isHidden() Tests whether the file named by this abstract pathname is a hidden file. The exact definition of hidden is system-dependent. On UNIX systems, a file is considered to be hidden if its name beg… Read More
  • How to replace all occurrences of a string String java.util.regex.Matcher.replaceAll(String replacement) Replaces every subsequence of the input sequence that matches the pattern with the given replacement string. This method first resets this matcher. It then scan… Read More
  • iText PDF Library Overview iText PDF :  iText is a Java library used to create PDF, read PDF and manipulate them. In following tutorials we will see how to create, read Manipulate PDF files with iText. This tutorial assumes that you have basis J… Read More
  • Blogger Comments
  • Facebook Comments
  • Disqus Comments

0 comments:

Post a Comment

Item Reviewed: Java Environment Setup in Linux Ubuntu with apt-get Rating: 5 Reviewed By: eHowToNow