views:

2027

answers:

3

I installed the Java 6 JRE on my VPS just fine, but I can't get the EE SDK installation to even run.

root@vps [/usr/java]# java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Client VM (build 16.0-b13, mixed mode)

However, when I try to run java_ee_sdk-6-unix.sh:

./  ../  java_ee_sdk-6-unix.sh*  jre1.6.0_18/  jre.bin*
root@vps [/usr/java]# ./java_ee_sdk-6-unix.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

But the catch is that I set my environment variables correctly:

root@vps [/usr/java]# echo $PATH
/usr/java/jre1.6.0_18:/usr/java/jre1.6.0_18/bin:/usr/java/jre1.6.0_18/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/bin:/sbin
root@vps [/usr/java]# export -p | grep JAVA_HOME
declare -x JAVA_HOME="/usr/java/jre1.6.0_18"

I'm pulling my hair out here, any ideas?

+1  A: 

Do you have a JDK installed? You likely want to put $JDK_HOME/bin on your PATH, not the /bin of a JRE, as jar comes with JDK, not JRE.

matt b
Yep, 100% correct. Fixed. Thanks.
David Titarenco
+1  A: 

Do this:

  1. Delete all installations of Java.
  2. Install the Java SDK (self-extracting) into /opt/jdk1.6.0_16 (for example)
  3. Create a symbolic link: ln -s /opt/jdk1.6.0_16 /opt/jdk
  4. Edit $HOME/.bashrc:

    JAVA_HOME=/opt/jdk
    PATH=$PATH:$HOME/bin:$JAVA_HOME/bin

  5. Logout and log back in.

This offers many advantages:

  • You can install multiple versions of the SDK and need only switch a symbolic link.
  • You know where all the files are located.
  • You know exactly which version of Java is being used.
  • No other versions are installed, so there cannot be any conflicts.

I have done this for years and have never had any problems with Java on Linux.

Also, stay away from the OpenJDK as its fonts are terrible to behold.

Dave Jarvis
A: 

In my case, I had jdk1.6.0_16 extracted in my home directory and had a symbolic links to java and /javac in /bin. Then I encountered the error described above in the question.

However once I included a symbolic link to jar in /bin, the shell script to install Java EE ran as expected.

Ramu Nachiappan