source: josm/trunk/linux/latest/usr/bin/josm-latest @ 8333

Last change on this file since 8333 was 8333, checked in by Don-vip, 4 years ago

see #11390 - prefer Java 8 runtime over Java 7 in launch script

  • Property svn:executable set to *
File size: 1.9 KB
Line 
1#!/bin/sh
2# Simple wrapper script used to start JOSM in Debian
3set -e
4
5# First, the alternative (if known to work) or users preference as defined by $JAVA_HOME. Next, use OpenJDK or Oracle's proprietary JDK.
6# Override to a specific one using $JAVACMD
7ALTERNATIVE_JDK="`readlink -n -f /etc/alternatives/java`"
8
9# Let's get the current architecture -- needed for multiarchified Java
10ARCH="`dpkg --print-architecture 2> /dev/null || true`"
11
12# If OpenJDK is only available headless, do not try it
13if dpkg --get-selections 'openjdk-*-jre' | grep install$ > /dev/null ; then
14        JAVA8_CMDS="/usr/lib/jvm/java-8-openjdk/bin/java /usr/lib/jvm/java-8-openjdk-$ARCH/bin/java /usr/lib/jvm/java-8-oracle/bin/java"
15        JAVA7_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"
16else
17        JAVA8_CMDS="/usr/lib/jvm/java-8-oracle/bin/java"
18        JAVA7_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"
19fi
20
21JAVA_OPTS="-Djosm.restart=true -Djosm.home=$HOME/.josm-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
22
23for jcmd in $JAVA8_CMDS; do
24        if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
25        JAVACMD="$jcmd"
26    fi
27done
28
29for jcmd in $JAVA8_CMDS; do
30    if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
31        JAVACMD="$jcmd"
32    fi
33done
34
35for jcmd in $JAVA7_CMDS; do
36        if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
37        JAVACMD="$jcmd"
38    fi
39done
40
41for jcmd in $JAVA7_CMDS; do
42    if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
43        JAVACMD="$jcmd"
44    fi
45done
46
47if [ "$JAVACMD" ]; then
48    echo "Using $JAVACMD to execute josm-latest." || true
49    set +e
50    while true; do
51        $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
52        if [ "z$?" != "z9" ]; then
53            break
54        fi
55        echo ">> restarting josm..."
56    done
57else
58    echo "No valid JVM found to run JOSM." || true
59    exit 1
60fi
Note: See TracBrowser for help on using the repository browser.