tags:

views:

305

answers:

2

I try to install GlassFish on Ubuntu, and I get the error:

Could not locate a suitable jar utility. Please ensure that you have Java 6 or newer installed on your system and accessible in your PATH or by setting JAVA_HOME

when I type

echo $PATH

it prints out:

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/opt/jdk1.6.0_20:/opt/jdk1.6.0_20/bin

Where is the problem and how to solve it?

I have also read "Problems installing Java EE SDK on Linux", but it doesn't work.

N.B. Before reinstalling Ubuntu it works fine. This problem comes after reinstallation.

+1  A: 

The problem is that you have */opt/jdk1.6.0_20* in your PATH and the java executables are located in */opt/jdk1.6.0_20/bin*. The best way is to define JAVA_HOME environment variable that contains */opt/jdk1.6.0_20* string and add $JAVA_HOME/bin to PATH variable.

Przemysław Różycki
It was already done, but anyway, it doesn't work!
artaxerxe
OK. So could you check if files like java, javac, etc. in /opt/jdk1.6.0_20/bin have executable permissions? And the user that GlassFish is running on, has necessary permissions to JDK directory and subdirectories?If yes, then what do you get when you type: java -version while being logged into the GlassFish user account?
Przemysław Różycki
Yes! All have executable permissions.And when I check for java version:~$ java -versionit gets:java version "1.6.0_20"Java(TM) SE Runtime Environment (build 1.6.0_20-b02)Java HotSpot(TM) Client VM (build 16.3-b01, mixed mode, sharing)
artaxerxe