Ubuntu – “Cannot locate suitable jar utility” while trying to install Oracle Java JDK

javasoftware installation

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.

Best Answer

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.

Related Question