Tag Archives: Download Java

Set JAVA_HOME on Linux

http://mshsoftware.com/site/kb/set-java-home-on-linux.html

How to set $JAVA_HOME variable on Linux

Article based on:

  • Linux Mint 14
  • Java 1.7

Should work on any Linux and Java version: Ubuntu, RedHat, CentOS, SUSE, ArchLinux, Debian, Fedora etc.

1. Install Java

If you have already installed Java then skip to point 3.

Before continue make sure you don’t have installed Java.

Open terminal and invoke:

whereis java

command. If you do not have Java then you will see:

java:

That will mean you DONT have Java.

Download Java from here or use your package manager to install it.

2. Java location

By default Java is located in

/usr/lib/jvm/java-<version>

directory.

3. Set $JAVA_HOME variable

To set JAVA_HOME only in actual shell session, invoke command:

export JAVA_HOME=/usr/lib/jvm/java-<version>

To persist this environment variable edit vi ~/.bash_profile file, and add JAVA_HOME definition:

JAVA_HOME=/usr/lib/jvm/java-<version>

Save and relogin to apply changes.

 

 

http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/