Modify

Opened 11 years ago

Closed 7 years ago

#8700 closed defect (fixed)

Missing path for java on Debian/Ubuntu

Reported by: ggeldenhuis Owned by: bastiK
Priority: minor Milestone:
Component: Ubuntu package Version:
Keywords: Cc:

Description

I uses a very old Ubuntu so not sure that this is a relevant but feel free to close it if it is not.

Running josm after a fresh install/update causes it to complain about the java version not being supported.

Running java -version on the command line give me:

java version "1.7.0_17"
Java(TM) SE Runtime Environment (build 1.7.0_17-b02)
Java HotSpot(TM) Server VM (build 23.7-b01, mixed mode)

so the java version is comparatively up to date.

The problem seems to be in the assumptions that is made about the path in the startup script.

The command whereis java shows:
/usr/bin/java

Adding that to the script called: /usr/bin/josm-latest on the following lines cause it to work properly.

# If OpenJDK is only available headless, do not try it
if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then

JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-openjdk/bin/java /usr/lib/jvm/java-6-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/bin/java"

else

JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"

fi

"Ubuntu 11.04"

Attachments (0)

Change History (17)

comment:1 by skyper, 11 years ago

Could you please add the result of

  • update-alternatives --list java
  • ls -og ($which java) and
  • ls -og /etc/alternatives/java?

Thanks

Mine are:

user@host:~$ update-alternatives --list java
/usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
user@host:~$ ls -og $(which java)
lrwxrwxrwx 1 22 Jun 19  2012 /usr/bin/java -> /etc/alternatives/java

and

user@host:~$ ls -og /etc/alternatives/java
lrwxrwxrwx 1 46 Jun 19  2012 /etc/alternatives/java -> /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java

comment:2 by skyper, 11 years ago

Component: CoreUbuntu package
Owner: changed from team to bastiK

comment:3 by ggeldenhuis, 11 years ago

As requested:
update-alternatives --list java
/usr/lib/jvm/java-6-openjdk/jre/bin/java
/usr/lib/jvm/java-7-oracle/jre/bin/java

ls -og $(which java)
lrwxrwxrwx 1 22 2013-04-08 18:40 /usr/bin/java -> /etc/alternatives/java

ls -og /etc/alternatives/java
lrwxrwxrwx 1 39 2013-04-08 18:40 /etc/alternatives/java -> /usr/lib/jvm/java-7-oracle/jre/bin/java

comment:4 by skyper, 11 years ago

Thanks

Sorry forgot the most important one:

ls -og /usr/lib/jvm/java-?-*/bin/java

comment:5 by ggeldenhuis, 11 years ago

ls -og /usr/lib/jvm/java-?-*/bin/java
lrwxrwxrwx 1 15 2012-10-30 23:58 /usr/lib/jvm/java-6-openjdk/bin/java -> ../jre/bin/java
lrwxrwxrwx 1 15 2013-04-08 18:32 /usr/lib/jvm/java-7-oracle-1.7.0.17/bin/java -> ../jre/bin/java
lrwxrwxrwx 1 15 2013-04-08 18:32 /usr/lib/jvm/java-7-oracle/bin/java -> ../jre/bin/java

comment:6 by skyper, 11 years ago

@bastiK

Pathes seem to be OK.
Is this intended to point the users to openjdk-7 ?

comment:7 by bastiK, 11 years ago

@skyper,ggeldenhuls: do you think the following fixes the problem?

  • latest/usr/bin/josm-latest

     
    1111
    1212# If OpenJDK is only available headless, do not try it
    1313if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
    14         JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-openjdk/bin/java /usr/lib/jvm/java-6-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-sun/bin/java"
     14        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/lib/jvm/java-6-openjdk/bin/java /usr/lib/jvm/java-6-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-sun/bin/java"
    1515else
    1616        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"
    1717fi
  • tested/usr/bin/josm

     
    1111
    1212# If OpenJDK is only available headless, do not try it
    1313if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
    14         JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-openjdk/bin/java /usr/lib/jvm/java-6-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-sun/bin/java"
     14        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/lib/jvm/java-6-openjdk/bin/java /usr/lib/jvm/java-6-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-sun/bin/java"
    1515else
    1616        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"
    1717fi

(updated tested version, latest will be fixed tomorrow)

comment:8 by Don-vip, 11 years ago

We should also update the "else" clause where Java 6 is before Java 7

in reply to:  7 ; comment:9 by skyper, 11 years ago

Replying to bastiK:

@skyper,ggeldenhuls: do you think the following fixes the problem?

Yes, this should work, Though I would add it just before java-6-sun.

I had a look at the whole file:
Problem is the else statement which will never be reached if any openjdk-* is proper installed but not used.

Don-Vip is right, with switching the versions in the else statement.

@bastiK:
Did not find the sources for the packages. Did look in the svn and in the repository.

comment:10 by skyper, 11 years ago

Actually the whole if statement should be adjusted. Think it is only needed if "alternatives" points to openjdk. Something like this should work (untested):

  • latest/usr/bin/josm-latest

     
    1010ARCH="`dpkg --print-architecture 2> /dev/null || true`"
    1111
    1212# If OpenJDK is only available headless, do not try it
    13 if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
    14        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/lib/jvm/java-6-openjdk/bin/java /usr/lib/jvm/java-6-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-sun/bin/java"
     13if [ readlink -n -f /etc/alternatives/java | grep openjdk ] && [ dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ]; then
     14       JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-openjdk/bin/java /usr/lib/jvm/java-7-openjdk-$ARCH/bin/java /usr/lib/jvm/java-6-openjdk/bin/java /usr/lib/jvm/java-6-openjdk-$ARCH/bin/java"
    1515else
    16        JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"
     16       JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/lib/jvm/java-6-sun/bin/java /usr/bin/java"
    1717fi
    1818
    1919JAVA_OPTS="-Djosm.home=$HOME/.josm-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"

EDT: Otherwise we will have the same problem with other javas and openjdk installed.

Last edited 11 years ago by skyper (previous) (diff)

in reply to:  9 ; comment:11 by bastiK, 11 years ago

Replying to skyper:

@bastiK:
Did not find the sources for the packages. Did look in the svn and in the repository.

The binary inside the .deb is identical to the .jar file you can download from this website. Everything else in the package is plain text.

At the moment I don't change anything unless there is a specific problem reported by a user. Generally, I try to keep the package in sync with the Debian package as much as possible. So you can help improving the "upstream" project, and the changes will be applied to our repository eventually.

in reply to:  8 ; comment:12 by bastiK, 11 years ago

Replying to Don-vip:

We should also update the "else" clause where Java 6 is before Java 7

Go ahead! :)

in reply to:  11 comment:13 by skyper, 11 years ago

Replying to bastiK:

Replying to skyper:

@bastiK:
Did not find the sources for the packages. Did look in the svn and in the repository.

The binary inside the .deb is identical to the .jar file you can download from this website. Everything else in the package is plain text.

At the moment I don't change anything unless there is a specific problem reported by a user. Generally, I try to keep the package in sync with the Debian package as much as possible. So you can help improving the "upstream" project, and the changes will be applied to our repository eventually.

Ok, I filled a bug "upstream": #708126

The order should not make any differences as the list is only used to find a exact match.

in reply to:  12 comment:14 by Don-vip, 11 years ago

Resolution: fixed
Status: newclosed

Replying to bastiK:

Replying to Don-vip:

We should also update the "else" clause where Java 6 is before Java 7

Go ahead! :)

Done:

svn ci -m "fix #8700 - use oracle-java-7 before sun-java-6"
Sending        apt-source/latest/usr/bin/josm-latest
Sending        apt-source/tested/usr/bin/josm
Transmitting file data ..
Committed revision 53.

comment:15 by skyper, 11 years ago

@ Donvip:
Did you try my suggestion or just fix the else clause ?

comment:16 by Don-vip, 11 years ago

Resolution: fixed
Status: closedreopened
Summary: Missing path for javaMissing path for java on Debian/Ubuntu

Just the else clause, I thought the other points had been fixed.
Sorry if I closed it too fast.

comment:17 by Don-vip, 7 years ago

Resolution: fixed
Status: reopenedclosed

I believe this has been fixed in the meanwhile with the transitions to Java 7 then Java 8.

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain bastiK.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.