Ubuntu: JAVA_HOME not defined correctly

I am trying to install some software (Shibboleth) in Ubuntu 14.04. I already have Java 7 OpenJDK installed in /usr/lib/jvm/ and I have these lines in /usr/environment

 JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64" export JAVA_HOME 

If I type echo $JAVA_HOME , I get /usr/lib/jvm/java-7-openjdk-amd64 . However, when I try to install Shibboleth, I always get Error: JAVA_HOME is not defined correctly. Cannot execute java Error: JAVA_HOME is not defined correctly. Cannot execute java .

Interestingly, if I type the java command, it works (it refers to / usr / lib / java, which is a link to the right one). However, when I try to run bash bin/install.sh Shibboleth, I get a JAVA_HOME error

I already tried installing JAVA_HOME in the jre folder with the same result. Any ideas?

+5
source share
2 answers

Add both JAVA_HOME and PATH to ~/.profile

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

And add the following to your /etc/profile.d/java.sh

 JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64 export JAVA_HOME PATH=${JAVA_HOME}/bin:${PATH} export PATH JRE_HOME=/usr/lib/jvm/jre export JRE_HOME JAVA_OPTS="-XX:+AggressiveOpts -Xms256m -Xmx512m -XX:MaxPermSize=256m -XX:+DisableExplicitGC" export JAVA_OPTS 

For more information, see the Documentation .

Hope this helps.

+9
source

you must set the path to the bin folder in which java, javac files are found. In your case, it could be / usr / lib / jvm / java-7-openjdk-amd64 / bin

0
source

Source: https://habr.com/ru/post/1241314/


All Articles