gui gui - 6 months ago 13
Java Question

Add JDK in Linux to run IDEA

I'm new in Linux & read a lot solution about add JDK in Ubuntu but not work! :/
I want to install JDK in Ubuntu.

I installed Ubuntu 12.04-i386 and downloaded JDK 8 and add

"/home/user/Soft/jdk1.8.0_20/bin"
to
"/etc/enviroment"
.

I run IntelliJ IDEA 13 (Community Edition) well, also write some project but after some day when I want lunch it,it says:


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


I installed
java-7-openjdk-i386
with Software Center and add "/usr/lib/jvm/java-7-openjdk-i386" in "/etc/enviroment" but still saying that.

What can I do?

Answer

I'm not sure, what you mean when saying "add", but I would suggest you just adding some lines into /etc/environment. What you need to do is modify PATH, specified in this file this way (I assume you use system-installed Java):

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-openjdk-i386/bin"

Also, you have to add JAVA_HOME enviroment variable definition in this file:

JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386/"

So, finally your file should like like

PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/jvm/java-7-openjdk-i386/bin"
JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386/"

If you want to manage Java installation yourself, you should use "/home/kaaveh/Soft/jdk1.8.0_20" instead of "/usr/lib/jvm/java-7-openjdk-i386/" in the code above.

After all these actions, you may need to restart your DE, so log out and then log in back.

Comments