blob: 5f31c53b7f091445004fc306c29359a2862cf785 (
plain)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
|
#!/bin/sh
# Uncomment the following line to override the JVM search sequence
# INSTALL4J_JAVA_HOME_OVERRIDE=
# Uncomment the following line to add additional VM parameters
# INSTALL4J_ADD_VM_PARAMS=
INSTALL4J_JAVA_PREFIX=""
read_db_entry() {
if [ -n "$INSTALL4J_NO_DB" ]; then
return 1
fi
db_file=$HOME/.install4j
if [ -d "$db_file" ] || ([ -f "$db_file" ] && [ ! -r "$db_file" ]) || ([ -f "$db_file" ] && [ ! -w "$db_file" ]); then
db_file=$HOME/.install4j_jre
fi
if [ ! -f "$db_file" ]; then
return 1
fi
if [ ! -x "$java_exc" ]; then
return 1
fi
found=1
exec 7< $db_file
while read r_type r_dir r_ver_major r_ver_minor r_ver_micro r_ver_patch r_ver_vendor<&7; do
if [ "$r_type" = "JRE_VERSION" ]; then
if [ "$r_dir" = "$test_dir" ]; then
ver_major=$r_ver_major
ver_minor=$r_ver_minor
ver_micro=$r_ver_micro
ver_patch=$r_ver_patch
fi
elif [ "$r_type" = "JRE_INFO" ]; then
if [ "$r_dir" = "$test_dir" ]; then
is_openjdk=$r_ver_major
found=0
break
fi
fi
done
exec 7<&-
return $found
}
create_db_entry() {
tested_jvm=true
echo testing JVM in $test_dir ...
version_output=`"$bin_dir/java" $1 -version 2>&1`
is_gcj=`expr "$version_output" : '.*gcj'`
is_openjdk=`expr "$version_output" : '.*OpenJDK'`
if [ "$is_gcj" = "0" ]; then
java_version=`expr "$version_output" : '.*"\(.*\)".*'`
ver_major=`expr "$java_version" : '\([0-9][0-9]*\)\..*'`
ver_minor=`expr "$java_version" : '[0-9][0-9]*\.\([0-9][0-9]*\)\..*'`
ver_micro=`expr "$java_version" : '[0-9][0-9]*\.[0-9][0-9]*\.\([0-9][0-9]*\).*'`
ver_patch=`expr "$java_version" : '[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[\._]\([0-9][0-9]*\).*'`
fi
if [ "$ver_patch" = "" ]; then
ver_patch=0
fi
if [ -n "$INSTALL4J_NO_DB" ]; then
return
fi
db_new_file=${db_file}_new
if [ -f "$db_file" ]; then
awk '$1 != "'"$test_dir"'" {print $0}' $db_file > $db_new_file
rm $db_file
mv $db_new_file $db_file
fi
dir_escaped=`echo "$test_dir" | sed -e 's/ /\\\\ /g'`
echo "JRE_VERSION $dir_escaped $ver_major $ver_minor $ver_micro $ver_patch" >> $db_file
echo "JRE_INFO $dir_escaped $is_openjdk" >> $db_file
}
test_jvm() {
tested_jvm=na
test_dir=$1
bin_dir=$test_dir/bin
java_exc=$bin_dir/java
if [ -z "$test_dir" ] || [ ! -d "$bin_dir" ] || [ ! -f "$java_exc" ] || [ ! -x "$java_exc" ]; then
return
fi
tested_jvm=false
read_db_entry || create_db_entry $2
if [ "$ver_major" = "" ]; then
return;
fi
if [ "$ver_major" -lt "1" ]; then
return;
elif [ "$ver_major" -eq "1" ]; then
if [ "$ver_minor" -lt "6" ]; then
return;
fi
fi
if [ "$ver_major" = "" ]; then
return;
fi
app_java_home=$test_dir
}
add_class_path() {
if [ -n "$1" ] && [ `expr "$1" : '.*\*'` -eq "0" ]; then
local_classpath="$local_classpath${local_classpath:+:}$1"
fi
}
compiz_workaround() {
if [ "$is_openjdk" != "0" ]; then
return;
fi
if [ "$ver_major" = "" ]; then
return;
fi
if [ "$ver_major" -gt "1" ]; then
return;
elif [ "$ver_major" -eq "1" ]; then
if [ "$ver_minor" -gt "6" ]; then
return;
elif [ "$ver_minor" -eq "6" ]; then
if [ "$ver_micro" -gt "0" ]; then
return;
elif [ "$ver_micro" -eq "0" ]; then
if [ "$ver_patch" -gt "09" ]; then
return;
fi
fi
fi
fi
osname=`uname -s`
if [ "$osname" = "Linux" ]; then
compiz=`ps -ef | grep -v grep | grep compiz`
if [ -n "$compiz" ]; then
export AWT_TOOLKIT=MToolkit
fi
fi
app_java_home=$test_dir
}
read_vmoptions() {
vmoptions_file=`eval echo "$1" 2>/dev/null`
if [ ! -r "$vmoptions_file" ]; then
vmoptions_file="$prg_dir/$vmoptions_file"
fi
if [ -r "$vmoptions_file" ]; then
exec 8< "$vmoptions_file"
while read cur_option<&8; do
is_comment=`expr "W$cur_option" : 'W *#.*'`
if [ "$is_comment" = "0" ]; then
vmo_classpath=`expr "W$cur_option" : 'W *-classpath \(.*\)'`
vmo_classpath_a=`expr "W$cur_option" : 'W *-classpath/a \(.*\)'`
vmo_classpath_p=`expr "W$cur_option" : 'W *-classpath/p \(.*\)'`
vmo_include=`expr "W$cur_option" : 'W *-include-options \(.*\)'`
if [ ! "$vmo_classpath" = "" ]; then
local_classpath="$i4j_classpath:$vmo_classpath"
elif [ ! "$vmo_classpath_a" = "" ]; then
local_classpath="${local_classpath}:${vmo_classpath_a}"
elif [ ! "$vmo_classpath_p" = "" ]; then
local_classpath="${vmo_classpath_p}:${local_classpath}"
elif [ "$vmo_include" = "" ]; then
if [ "W$vmov_1" = "W" ]; then
vmov_1="$cur_option"
elif [ "W$vmov_2" = "W" ]; then
vmov_2="$cur_option"
elif [ "W$vmov_3" = "W" ]; then
vmov_3="$cur_option"
elif [ "W$vmov_4" = "W" ]; then
vmov_4="$cur_option"
elif [ "W$vmov_5" = "W" ]; then
vmov_5="$cur_option"
else
vmoptions_val="$vmoptions_val $cur_option"
fi
fi
fi
done
exec 8<&-
if [ ! "$vmo_include" = "" ]; then
read_vmoptions "$vmo_include"
fi
fi
}
run_unpack200() {
if [ -f "$1/lib/rt.jar.pack" ]; then
old_pwd200=`pwd`
cd "$1"
echo "Preparing JRE ..."
jar_files="lib/rt.jar lib/charsets.jar lib/plugin.jar lib/deploy.jar lib/ext/localedata.jar lib/jsse.jar"
for jar_file in $jar_files
do
if [ -f "${jar_file}.pack" ]; then
bin/unpack200 -r ${jar_file}.pack $jar_file
if [ $? -ne 0 ]; then
echo "Error unpacking jar files. The architecture or bitness (32/64)"
echo "of the bundled JVM might not match your machine."
echo "You might also need administrative privileges for this operation."
exit 1
fi
fi
done
cd "$old_pwd200"
fi
}
old_pwd=`pwd`
progname=`basename "$0"`
linkdir=`dirname "$0"`
cd "$linkdir"
prg="$progname"
while [ -h "$prg" ] ; do
ls=`ls -ld "$prg"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '.*/.*' > /dev/null; then
prg="$link"
else
prg="`dirname $prg`/$link"
fi
done
prg_dir=`dirname "$prg"`
progname=`basename "$prg"`
cd "$prg_dir"
prg_dir=`pwd`
app_home=.
cd "$app_home"
app_home=`pwd`
bundled_jre_home="$app_home/jre"
if [ "__i4j_lang_restart" = "$1" ]; then
cd "$old_pwd"
else
cd "$prg_dir"/..
fi
if [ -z "$app_java_home" ]; then
test_jvm $INSTALL4J_JAVA_HOME_OVERRIDE
fi
if [ -z "$app_java_home" ]; then
if [ -f "$app_home/.install4j/pref_jre.cfg" ]; then
read file_jvm_home < "$app_home/.install4j/pref_jre.cfg"
test_jvm "$file_jvm_home"
if [ -z "$app_java_home" ] && [ $tested_jvm = "false" ]; then
rm $db_file
test_jvm "$file_jvm_home"
fi
fi
fi
if [ -z "$app_java_home" ]; then
test_jvm "$app_home/jre"
if [ -z "$app_java_home" ] && [ $tested_jvm = "false" ]; then
rm $db_file
test_jvm "$app_home/jre"
fi
fi
if [ -z "$app_java_home" ]; then
test_jvm "$app_home/jre"
if [ -z "$app_java_home" ] && [ $tested_jvm = "false" ]; then
rm $db_file
test_jvm "$app_home/jre"
fi
fi
if [ -z "$app_java_home" ]; then
path_java=`which java 2> /dev/null`
path_java_home=`expr "$path_java" : '\(.*\)/bin/java$'`
test_jvm $path_java_home
fi
if [ -z "$app_java_home" ]; then
common_jvm_locations="/opt/i4j_jres/* /usr/local/i4j_jres/* $HOME/.i4j_jres/* /usr/bin/java* /usr/bin/jdk* /usr/bin/jre* /usr/bin/j2*re* /usr/bin/j2sdk* /usr/java* /usr/jdk* /usr/jre* /usr/j2*re* /usr/j2sdk* /usr/java/j2*re* /usr/java/j2sdk* /opt/java* /usr/java/jdk* /usr/java/jre* /usr/lib/java/jre /usr/local/java* /usr/local/jdk* /usr/local/jre* /usr/local/j2*re* /usr/local/j2sdk* /usr/jdk/java* /usr/jdk/jdk* /usr/jdk/jre* /usr/jdk/j2*re* /usr/jdk/j2sdk* /usr/lib/jvm/* /usr/lib/java* /usr/lib/jdk* /usr/lib/jre* /usr/lib/j2*re* /usr/lib/j2sdk* /System/Library/Frameworks/JavaVM.framework/Versions/1.?/Home"
for current_location in $common_jvm_locations
do
if [ -z "$app_java_home" ]; then
test_jvm $current_location
fi
done
fi
if [ -z "$app_java_home" ]; then
test_jvm $JAVA_HOME
fi
if [ -z "$app_java_home" ]; then
test_jvm $JDK_HOME
fi
if [ -z "$app_java_home" ]; then
test_jvm $INSTALL4J_JAVA_HOME
fi
if [ -z "$app_java_home" ]; then
if [ -f "$app_home/.install4j/inst_jre.cfg" ]; then
read file_jvm_home < "$app_home/.install4j/inst_jre.cfg"
test_jvm "$file_jvm_home"
if [ -z "$app_java_home" ] && [ $tested_jvm = "false" ]; then
rm $db_file
test_jvm "$file_jvm_home"
fi
fi
fi
if [ -z "$app_java_home" ]; then
if [ ! "__i4j_lang_restart" = "$1" ]; then
run_unpack200 "$bundled_jre_home"
run_unpack200 "$bundled_jre_home/jre"
fi
fi
if [ -z "$app_java_home" ]; then
echo No suitable Java Virtual Machine could be found on your system.
echo The version of the JVM must be at least 1.6..
echo Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
echo You can also try to delete the JVM cache file $db_file
exit 83
fi
compiz_workaround
i4j_classpath="$app_home/.install4j/i4jruntime.jar"
local_classpath=""
add_class_path "$i4j_classpath"
add_class_path "$app_home/.install4j/user.jar"
for i in `ls "$app_home/.install4j/user" 2> /dev/null | egrep "\.(jar$|zip$)"`
do
add_class_path "$app_home/.install4j/user/$i"
done
vmoptions_val=""
read_vmoptions "$prg_dir/$progname.vmoptions"
INSTALL4J_ADD_VM_PARAMS="$INSTALL4J_ADD_VM_PARAMS $vmoptions_val"
LD_LIBRARY_PATH="$app_home/.install4j:$LD_LIBRARY_PATH"
DYLD_LIBRARY_PATH="$app_home/.install4j:$DYLD_LIBRARY_PATH"
SHLIB_PATH="$app_home/.install4j:$SHLIB_PATH"
LIBPATH="$app_home/.install4j:$LIBPATH"
LD_LIBRARYN32_PATH="$app_home/.install4j:$LD_LIBRARYN32_PATH"
LD_LIBRARYN64_PATH="$app_home/.install4j:$LD_LIBRARYN64_PATH"
export LD_LIBRARY_PATH
export DYLD_LIBRARY_PATH
export SHLIB_PATH
export LIBPATH
export LD_LIBRARYN32_PATH
export LD_LIBRARYN64_PATH
INSTALL4J_ADD_VM_PARAMS="$INSTALL4J_ADD_VM_PARAMS -Di4j.vpt=true"
for param in $@; do
if [ `echo "W$param" | cut -c -3` = "W-J" ]; then
INSTALL4J_ADD_VM_PARAMS="$INSTALL4J_ADD_VM_PARAMS `echo "$param" | cut -c 3-`"
fi
done
ui_last_wd=`pwd`
cd "$app_home"
if [ -d jre ]; then
jsa_files=`find jre -name classes.jsa`
for jsa_file in $jsa_files
do
chmod +w $jsa_file
rm $jsa_file
done
fi
cd "$ui_last_wd"
if [ "W$vmov_1" = "W" ]; then
vmov_1="-Di4j.vmov=true"
fi
if [ "W$vmov_2" = "W" ]; then
vmov_2="-Di4j.vmov=true"
fi
if [ "W$vmov_3" = "W" ]; then
vmov_3="-Di4j.vmov=true"
fi
if [ "W$vmov_4" = "W" ]; then
vmov_4="-Di4j.vmov=true"
fi
if [ "W$vmov_5" = "W" ]; then
vmov_5="-Di4j.vmov=true"
fi
$INSTALL4J_JAVA_PREFIX "$app_java_home/bin/java" -Dinstall4j.jvmDir="$app_java_home" -Dexe4j.moduleName="$prg_dir/$progname" -Djava.ext.dirs="$app_java_home/lib/ext" "$vmov_1" "$vmov_2" "$vmov_3" "$vmov_4" "$vmov_5" $INSTALL4J_ADD_VM_PARAMS -classpath "$local_classpath" com.install4j.runtime.launcher.Launcher launch com.install4j.runtime.installer.Uninstaller true false "" "" true true false "" true true 0 0 "" 20 20 "Arial" "0,0,0" 8 500 "version 0.9" 20 40 "Arial" "0,0,0" 8 500 -1 "$@"
exit $?
|