Linux – JAVA_HOME errors when run without sudo

javalinux-mint

Hello I am on Linux Mint 16 KDE 64.

I have OpenJDK 7 installed and Oracle JDK 7 and if I run Intellij as a normal user I get:

'tools.jar' seems to be not in IDEA classpath.
Please ensure JAVA_HOME points to JDK rather than JRE

Also if I run gradle build on any of our projects as a normal user I get:

Cannot find System Java Compiler. Ensure that you have installed a JDK (not just a JRE) and configured your JAVA_HOME system variable to point to the according directory.

If I run

echo $JAVA_HOME

Then I get:

/usr/lib/jvm/default-java

I get the same thing if I run it with sudo.

As per the comments below javac -version produces:

javac 1.7.0_51

Same result with sudo.

What am I doing wrong?

Best Answer

You installed only JRE. Try to install JDK:

sudo apt-get install openjdk-7-jdk

Related Question