stevengfowler
stevengfowler

Reputation: 141

Setting up artifactory on Ubuntu: ERROR: cannot find a JRE or JDK

When attempting to install artifactory, I run the following command:

 sudo service artifactory check

I get the following output:

Created output file /root/artifactory-2.3.2/logs/consoleout.log
Cannot find a JRE or JDK. Please set JAVA_HOME to a >=1.5 JRE

I used the following to get my java home:

# which java
/usr/bin/java

I have added the java home to the etc/artifactory/default as follows:

export JAVA_HOME=/usr/bin/java

My /etc/environment looks like:

JAVA_HOME="/usr/bin/java"

What am I doing wrong?

Upvotes: 1

Views: 1915

Answers (1)

gareth_bowles
gareth_bowles

Reputation: 21130

JAVA_HOME should be set to the directory one level above the "bin" subdirectory containing the Java executable file, not the file itself. /usr/bin/java on Ubuntu is a symlink to the actual Java installation. Find the actual directory like this (I pasted the commands from my system):

$ ls -l /usr/bin/java
lrwxrwxrwx 1 root root 22 2012-06-14 17:33 /usr/bin/java -> /etc/alternatives/java*
$ ls -l /etc/alternative/java
lrwxrwxrwx 1 root root 35 2012-06-14 17:33 /etc/alternatives/java -> /usr/lib/jvm/java-7-oracle/bin/java*

So in my case JAVA_HOME should be set to /usr/lib/jvm/java-7-oracle - your system may be different.

You should also add the bin subdirectory to your PATH:

export PATH=$PATH:$JAVA_HOME/bin

Try typing

java -version

from the command line to test out your settings.

Upvotes: 2

Related Questions