Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

Neither the JAVA_HOME nor the JRE_HOME environment variable is defined

If you need a different version or are targeting a different version of Java, change version number accordingly the rest is the same.

Going in hard; let's get some root on
sudo su Enter password if you need to.

If you prefer, you can enter sudo before each command.

Install Java

apt-get install openjdk-7-jre-headless

Find Java

Little tip:
Installing locate helps a whole lot on Linux, in Ubuntu, it's usually installed by default (if it's not, Ubuntu will tell you to apt-get install locate)

In the case of Java Ubuntu (and Debian based releases) installs Java into /usr/lib/jvm so navigating to it, cd /usr/lib/jvm then ls will give you your folder path. There should be one with a long version than a short one like this...

ls /usr/lib/jvm
default-java  java-1.7.0-openjdk-amd64  java-7-openjdk-amd64

Set the paths

Make a note of the paths then:

nano /etc/profile

Then add your paths before the if statement.

  export PATH=$PATH:/usr/lib/jvm/java-7-openjdk-amd64/bin
  export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64
Chris McKee

Chris McKee

https://chrismckee.co.uk

Software Engineer, Web Front/Backend/Architecture; all-round tech obsessed geek. I hate unnecessary optimism