1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
Description: JAVACMD->JAVA_CMD, use java-wrappers.sh instead of findjava
if available, set org.freeplane.basedirectory to /usr/share/freeplane
(not the path to the knopflerfish jar)
Author: Felix Natter <fnatter@gmx.net>
Forwarded: no
Last-Update: 2016-05-05
--- a/freeplane_framework/script/freeplane.sh
+++ b/freeplane_framework/script/freeplane.sh
@@ -5,6 +5,13 @@
set -x
fi
+# debug also java-wrapper
+if [ -n "${DEBUG}" ]
+then
+ DEBUG_WRAPPER=1
+ export DEBUG_WRAPPER
+fi
+
########## FUNCTIONS DEFINITIONS #######################################
_debug() {
@@ -29,36 +36,36 @@
findjava() {
# We try hard to find the proper 'java' command
- if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]; then
- _debug "Using \$JAVACMD to find java virtual machine."
+ if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ]; then
+ _debug "Using \$JAVA_CMD to find java virtual machine."
elif [ -n "${JAVA_BINDIR}" ] && [ -x "${JAVA_BINDIR}/java" ]; then
- JAVACMD="${JAVA_BINDIR}/java"
+ JAVA_CMD="${JAVA_BINDIR}/java"
_debug "Using \$JAVA_BINDIR to find java virtual machine."
elif [ -n "${JAVA_HOME}" ] && [ -x "${JAVA_HOME}/bin/java" ]; then
- JAVACMD="${JAVA_HOME}/bin/java"
+ JAVA_CMD="${JAVA_HOME}/bin/java"
_debug "Using \$JAVA_HOME to find java virtual machine."
else
- JAVACMD=$(which java)
- if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]; then
+ JAVA_CMD=$(which java)
+ if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ]; then
_debug "Using \$PATH to find java virtual machine."
elif [ -x /usr/bin/java ]; then
_debug "Using /usr/bin/java to find java virtual machine."
- JAVACMD=/usr/bin/java
+ JAVA_CMD=/usr/bin/java
fi
fi
# if we were successful, we return 0 else we complain and return 1
- if [ -n "${JAVACMD}" ] && [ -x "${JAVACMD}" ]; then
- _debug "Using '$JAVACMD' as java virtual machine..."
+ if [ -n "${JAVA_CMD}" ] && [ -x "${JAVA_CMD}" ]; then
+ _debug "Using '$JAVA_CMD' as java virtual machine..."
if [ -n "${DEBUG}" ]; then
- "$JAVACMD" -version >&2
+ "$JAVA_CMD" -version >&2
fi
- if (! "${JAVACMD}" -version 2>&1 | grep -qe 'Java(TM)' -e OpenJDK); then
+ if (! "${JAVA_CMD}" -version 2>&1 | grep -qe 'Java(TM)' -e OpenJDK); then
_error "Your Java is not a derivative from Sun's code," \
"========================================" \
"FREEPLANE WILL MOST PROBABLY *NOT* WORK," \
"========================================" \
- "define JAVACMD, JAVA_BINDIR, JAVA_HOME or PATH" \
+ "define JAVA_CMD, JAVA_BINDIR, JAVA_HOME or PATH" \
"in order to point to such a VM." \
"See the manpage of freeplane(1) for details."
JAVA_TYPE=other
@@ -68,7 +75,7 @@
return 0
else
_error "Couldn't find a java virtual machine," \
- "define JAVACMD, JAVA_BINDIR, JAVA_HOME or PATH."
+ "define JAVA_CMD, JAVA_BINDIR, JAVA_HOME or PATH."
return 1
fi
}
@@ -119,9 +126,16 @@
_source /etc/freeplane/freeplanerc
_source "${userfpdir}/freeplanerc"
-findjava
-if [ $? -ne 0 ]; then
- exit 1
+if [ -r /usr/lib/java-wrappers/java-wrappers.sh ]
+then # the Debian method
+ . /usr/lib/java-wrappers/java-wrappers.sh
+ require_java_runtime java7
+else
+ findjava
+ if [ $? -ne 0 ]
+ then
+ exit 1
+ fi
fi
output_debug_info
@@ -179,7 +193,8 @@
fi
_debug "Calling: "\
-"${JAVACMD}" -Xmx512m\
+"${JAVA_CMD}" -Xmx512m\
+ "-Dorg.freeplane.basedirectory=${freedir}"\
"-Dorg.freeplane.userfpdir=$userfpdir"\
"-Dorg.freeplane.old_userfpdir=$old_userfpdir"\
"-Dorg.freeplane.globalresourcedir=${freedir}/resources"\
@@ -191,7 +206,8 @@
( echo "${DEBUG}" | grep -qe "exit" ) && exit 0 # do not start Freeplane
# now actually launch Freeplane
-"${JAVACMD}" -Xmx512m\
+"${JAVA_CMD}" -Xmx512m\
+ "-Dorg.freeplane.basedirectory=${freedir}"\
"-Dorg.freeplane.userfpdir=$userfpdir"\
"-Dorg.freeplane.old_userfpdir=$old_userfpdir"\
"-Dorg.freeplane.globalresourcedir=${freedir}/resources"\
|