0
votes

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.

3
What is the value of ´$JAVA_HOME´? - Bastien Léonard
Also, how did you install it? If you got Glassfish from the official website, try to install from packages instead. - Bastien Léonard
Also, on the command line, type javac. That should be found, though it will return an error because there are no input files. If it is not found, check whether there is something in /opt/jdk1.6.0_20/bin. - extraneon
Is Java installed correctly? What happens if you run the command jar, or java or javac? - Jesper
If i type javac, it also works. - artaxerxe

3 Answers

3
votes

if you follow this tutorial you should be fine and all you problems will be gone: http://www.nabisoft.com/tutorials/glassfish/installing-glassfish-301-on-ubuntu

2
votes

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.

0
votes

The problem was related to user permissions. I think I tried to install GlassFish without enough rights.