Brown
Brown

Reputation: 23

error when installing Java EE SDK on Linux

I did have JDK installed, and also put $JDK_HOME/bin on my PATH. However, I still have problem to install Java EE. Could you guys give me some hints? Thanks.

dav@Bruno:~$ ls
[some stuff...]
33511405_3645.jpg               glassfish                      stuff
bea                             hplip-3.11.12-plugin.run       temp
bin                             hpscan001.png                  Templates
C03_08.txt                      java_ee_sdk-6u4-jdk7-linux.sh  Tomcat
c4c                             jdk1.7.0_10                   Ubuntu One
[some stuff2...]

dav@Bruno:~$ echo $PATH

/home/dav/jdk1.7.0_10/lib:/usr/share/java:/home/dav/jdk1.7.0_10:/home/dav/jdk1.7.0_10/bin:/home/dav/Fluent.Inc/bin:/home/dav/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/home/dav/jdk1.7.0_10/lib:/usr/share/java

dav@Bruno:~$ sudo sh java_ee_sdk-6u4-jdk7-linux.sh

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
dav@Bruno:~$ 

Upvotes: 2

Views: 1836

Answers (3)

John Bleeker
John Bleeker

Reputation: 11

in case someone still gets frustrated over this:

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

First of all make sure you are not using "sudo" to install java ee. when you use sudo you use a different environment (root, with not necessarily the same environment variables). in this case (ee installation) sudo is not required.

In other (which ever) cases when root access is required make sure the required user/system variables are set on system level, not (just) on user level.

to set variables at system level instead of user level define the variables in a system level script, i.e. /etc/profile or /etc/profile.d

otherwise, if you are not using SUDO trying to install jee, and still have this "JAVA_HOME not set"-problem, try this:

the cause seems to be the JAVA_HOME variable that can not be found by the install script. therefore adjust ~/.bashrc to define JAVA_HOME. JAVA_HOME of course has to point to your oracle java (se/jdk) installation. If you haven't installed it, that's the first thing to do. JAVA_HOME should point at the root directory of the installation (not to the bin directory in it), i.e.:

  export JAVA_HOME=/usr/local/jdk1.7.1_02.

Next change path like so: PATH=$JAVA_HOME:$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH

  • keep the faith
  • don't let frustrations get the better of you (perhaps making you take it out on your colleagues or loved ones :o )
  • don't allow stress to build up too much. take a break in time to watch a funny video or
  • take a stroll to the coffee machine, or have a little chat with that cute person a couple of desks away from you.

Upvotes: 1

Andrew Bryant
Andrew Bryant

Reputation: 529

I think the problem you're facing is that the PATH variable you're looking at is set for the user 'dav', but because you're sudoing the sh command, the PATH changes to that of root, which probably doesn't contain the JDK.

I think you should try explicitly setting the JAVA_HOME environment variable, try running:

sudo JAVA_HOME=/home/dav/jdk1.7.0_10 sh java_ee_sdk-6u4-jdk7-linux.sh

Upvotes: 1

Swapnil
Swapnil

Reputation: 8328

You'll need to create an update alternative for the "jar" executable like:

sudo update-alternatives --install "/usr/bin/jar" "jar" "/usr/lib/jvm/jdk1.6.0/bin/jar" 1

Note: You may need to use appropriate path in your case.

Upvotes: 0

Related Questions