java-wrappers fails ito find java runtimes installed in /opt

Bug #1025914 reported by Darko S on 2012-07-17
This bug affects 2 people
Affects Status Importance Assigned to Milestone
java-wrappers (Ubuntu)

Bug Description

java-wrappers failed to find java runtime installed in /opt, which caused all java-based program failed to launch, if the user installed java runtime from Oracle.

apt-cache rdepends java-wrappers
Reverse Depends:

[Test Case]

UBUNTU RELEASE (cat /etc/lsb-release)

ii freemind 0.9.0+dfsg-1 Java Program for creating and viewing Mindmaps
ii java-wrappers 0.1.24 wrappers for java executables

When /etc/alternatives/java points to java runtime installed in /opt (example may be /opt/ibm-java-i386-60/bin/java), then in /usr/lib/java-wrappers/ emply value is assigned to __jvm_alt in following assignment:

__jvm_alt=$(readlink /etc/alternatives/java|sed -n 's/\(\/usr\/lib\/jvm\/[^\/]*\)\/.*/\1/p')

Reason is that bacause sed expression did not match path in /opt/..., no substitution is made, and such sed statement prints pattern space only if substitution is made.

Therefore in /usr/lib/java-wrappers/ fgrep in following code always succeeds and JAVA_HOME is set to empty:
 if echo "$DIRS" | fgrep "$__jvm_alt" > /dev/null ; then
     java_debug "Picking up the JVM designated by the alternatives system: "
     java_debug " JAVA_HOME = '$JAVA_HOME'"

        # And pick up the first one that works reasonably
     for dir in $DIRS; do
  if [ -x $dir/bin/java ]; then

This eventually leads to this abnormal exit:
    if [ "$JAVA_HOME" ] ; then
 # ... omitted ...
 java_warning "No java runtime was found"
 return 1;

Hence other packages that use java-wrappers, e.g. freemind, experience other failures because java-wrappers failure. In example of freemind, it will not start at all.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in java-wrappers (Ubuntu):
status: New → Confirmed
Rex Tsai (chihchun) wrote :
Changed in java-wrappers (Ubuntu):
status: Confirmed → In Progress
Rex Tsai (chihchun) on 2012-09-20
description: updated
Rex Tsai (chihchun) on 2012-09-26
Changed in java-wrappers (Ubuntu):
assignee: nobody → Rex Tsai (chihchun)
Rex Tsai (chihchun) on 2013-09-23
Changed in java-wrappers (Ubuntu):
assignee: Rex Tsai (chihchun) → nobody
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers