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

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

see #11924, see #15128 - add Java 9 option --add-modules java.se.ee for plugins requiring JAXB in Linux startup script

  • Property svn:executable set to *
File size: 2.1 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"
15 JAVA_CMDS="${JAVA_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"
16 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-openjdk/bin/java /usr/lib/jvm/java-9-openjdk-$ARCH/bin/java /usr/lib/jvm/java-9-oracle/bin/java"
17else
18 JAVA_CMDS="$JAVA_HOME/bin/java /usr/bin/java"
19 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-8-oracle/bin/java"
20 JAVA_CMDS="${JAVA_CMDS} /usr/lib/jvm/java-9-oracle/bin/java"
21fi
22
23if [ -f /etc/default/josm-latest ]; then
24 . /etc/default/josm-latest
25fi
26
27JAVA_OPTS="-Djosm.restart=true -Djosm.dir.name=JOSM-latest -Djava.net.useSystemProxies=true $JAVA_OPTS"
28
29if [ -z "${JAVACMD}" ]; then
30 for jcmd in $JAVA_CMDS; do
31 if [ "z$ALTERNATIVE_JDK" = "z`readlink -n -f $jcmd`" ] && [ -z "${JAVACMD}" ]; then
32 JAVACMD="$jcmd"
33 break
34 fi
35 done
36fi
37
38if [ -z "${JAVACMD}" ]; then
39 for jcmd in $JAVA_CMDS; do
40 if [ -x "$jcmd" -a -z "${JAVACMD}" ]; then
41 JAVACMD="$jcmd"
42 break
43 fi
44 done
45fi
46
47if [ "$JAVACMD" ]; then
48 echo "Using $JAVACMD to execute josm-latest." || true
49 if [[ $JAVACMD == *"java-9"* ]]; then
50 JAVA_OPTS="--add-modules java.se.ee $JAVA_OPTS"
51 fi
52 set +e
53 while true; do
54 $JAVACMD $JAVA_OPTS -jar /usr/share/josm-latest/josm-latest.jar "$@"
55 if [ "z$?" != "z9" ]; then
56 break
57 fi
58 echo ">> restarting josm..."
59 done
60else
61 echo "No valid JVM found to run JOSM." || true
62 exit 1
63fi
Note: See TracBrowser for help on using the repository browser.