source: josm/trunk/linux/tested/usr/bin/josm@ 8317

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

see #11390 - accept openjdk-8-jre in Debian control file, prefer Java 8 runtime over Java 7 in launch script

  • Property svn:executable set to *
File size: 1.6 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 JAVA_CMDS="$JAVA_HOME/bin/java /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 /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"
15else
16 JAVA_CMDS="$JAVA_HOME/bin/java /usr/lib/jvm/java-8-oracle/bin/java /usr/lib/jvm/java-7-oracle/bin/java /usr/bin/java"
17fi
18
19JAVA_OPTS="-Djosm.restart=true -Djava.net.useSystemProxies=true $JAVA_OPTS"
20
21for jcmd in $JAVA_CMDS; do
22 if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
23 JAVACMD="$jcmd"
24 fi
25done
26
27for jcmd in $JAVA_CMDS; do
28 if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
29 JAVACMD="$jcmd"
30 fi
31done
32
33if [ "$JAVACMD" ]; then
34 echo "Using $JAVACMD to execute josm." || true
35 set +e
36 while true; do
37 $JAVACMD $JAVA_OPTS -jar /usr/share/josm/josm.jar "$@"
38 if [ "z$?" != "z9" ]; then
39 break
40 fi
41 echo ">> restarting josm..."
42 done
43else
44 echo "No valid JVM found to run JOSM." || true
45 exit 1
46fi
Note: See TracBrowser for help on using the repository browser.