5

I have installed jdk-7u3-linux-i586.tar.gz according to this:

How do I install Oracle Java JDK 7?

But when I try to install java_ee_sdk-6u4-unix.sh using the command sudo sh java_ee_sdk-6u4-unix.sh from inside the /home//Downloads/ directory I get the message

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

Note: Even though I get the mesage "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" commands "java", "javac" are working from any location.

Varuna
  • 245

4 Answers4

2

The problem is the same that for other programs (java, javac, javaws etc.) You just need to create an update alternative for the "jar" program like this:

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

Note: remember to replace the "jdk1.7.0" path by the real name of your target jdk installation path if it is different.

1
  • Download the .tar.gz package from here.
  • Unzip it to a location ( say ~/java/ )
  • run
     update-alternatives --install "/usr/bin/java" "java" 
    ( Assuming that you have update-alternatives installed already. You should, if you you openjdk installed.)

Those steps should make java available globally.

0

The quick-and-dirty solution:

At the command prompt type:

sudo apt-get install jarwrapper fastjar

Now, when you run ./java_ee_sdk-6u4-unix.sh again, it should install without a hitch.

RedFred
  • 101
-1
#!/bin/bash
#Author: Yucca Nel http://thejarbar.org
#Will restart system
#Modify these variables as needed...
tempWork=/tmp/work
locBin=/usr/local/bin
javaUsrLib=/usr/lib/jvm

sudo mkdir -p $javaUsrLib
mkdir -p $tempWork
cd $tempWork

#Update this line to reflect newer versions of JDK...
wget --no-cookies --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2Ftechnetwork%2Fjava%2Fjavase%2Fdownloads%2Fjdk-7u3-download-1501626.html;" http://download.oracle.com/otn-pub/java/jdk/7u3-b04/jdk-7u3-linux-i586.tar.gz

#Extract the download
tar -zxvf $tempWork/*

#Move it to where it can be found...

sudo mv -f $tempWork/jdk1* $javaUsrLib/

sudo ln -f -s $javaUsrLib/jdk1*/bin/* /usr/bin/
sudo rm -rf $tempWork
#Update this line to reflect newer versions of JDK...
export JAVA_HOME="$javaUsrLib/jdk1.7.0_03"

if ! grep "JAVA_HOME=$javaUsrLib/jdk1.7.0_03" /etc/environment
then
    echo "JAVA_HOME=$javaUsrLib/jdk1.7.0_03"| sudo tee -a /etc/environment
fi


exit 0