svn-gvsig-desktop / tags / v2_0_0_Build_2061 / build / product / gvSIG.sh
History | View | Annotate | Download (4.91 KB)
1 |
#!/bin/sh |
---|---|
2 |
# gvSIG.sh |
3 |
|
4 |
########################################### |
5 |
# Variables depending on the installation # |
6 |
########################################### |
7 |
|
8 |
set -e |
9 |
#set -x |
10 |
|
11 |
if type which >/dev/null; then |
12 |
WHICH=which |
13 |
else |
14 |
WHICH=type |
15 |
fi |
16 |
|
17 |
FORCE_JAVA_32BITS="" |
18 |
JAVA_HOME_OTHER_ARCHITECTURE="" |
19 |
PRIVATE_JAVA_HOME="$HOME/gvSIG/jre/*1.6* $HOME/gvSIG/jre/*1.5*" |
20 |
# |
21 |
# in next line, JAVA_HOME is set during instalation process |
22 |
DEFAULT_JAVA_HOME="${JAVA_HOME}" |
23 |
# |
24 |
# |
25 |
# Try to use java from: |
26 |
# 1. Java specified in JAVA_HOME variable |
27 |
# 2. Java specified in the instalation process |
28 |
# 3. Java in the HOME/gvsig/jre folder (optionally created during installation process) |
29 |
# 4. Java in the system path. |
30 |
# |
31 |
for JAVA_HOME_TO_USE in "$JAVA_HOME" "$DEFAULT_JAVA_HOME" $PRIVATE_JAVA_HOME "" |
32 |
do |
33 |
if [ "$JAVA_HOME_TO_USE" = "" ] ; then |
34 |
continue |
35 |
fi |
36 |
if [ ! -d "$JAVA_HOME_TO_USE" ] ; then |
37 |
echo "WARNING: Incorrect JAVA_HOME ($JAVA_HOME_TO_USE), skip" |
38 |
continue |
39 |
fi |
40 |
if [ ! -x "$JAVA_HOME_TO_USE/bin/java" ] ; then |
41 |
echo "WARNING: Incorrect JAVA_HOME ($JAVA_HOME_TO_USE), bin/java not found, skip" |
42 |
continue |
43 |
fi |
44 |
if ! "$JAVA_HOME_TO_USE/bin/java" -d32 -version 2>/dev/null ; then |
45 |
JAVA_HOME_OTHER_ARCHITECTURE="$JAVA_HOME_TO_USE" |
46 |
echo "WARNING: java 32 bits not found in $JAVA_HOME_TO_USE, skip" |
47 |
continue |
48 |
fi |
49 |
break |
50 |
done |
51 |
if [ "$JAVA_HOME_TO_USE" = "" ] ; then |
52 |
# Try to use the java in the system path |
53 |
if ! type java >/dev/null ; then |
54 |
# java not found in the system path |
55 |
if [ "$JAVA_HOME_OTHER_ARCHITECTURE" != "" ] ; then |
56 |
FORCE_JAVA_32BITS="" |
57 |
JAVA_HOME="$JAVA_HOME_OTHER_ARCHITECTURE" |
58 |
JAVA="$JAVA_HOME/bin/java" |
59 |
echo "WARNING: java 32 bits not found in the system path, using $JAVA_HOME_OTHER_ARCHITECTURE" |
60 |
else |
61 |
echo "WARNING: java not found in the system" |
62 |
exit 1 |
63 |
fi |
64 |
else |
65 |
if ! java -d32 -version 2>/dev/null ; then |
66 |
FORCE_JAVA_32BITS="" |
67 |
echo "WARNING: java 32 bits not found, using $($WHICH java)" |
68 |
else |
69 |
FORCE_JAVA_32BITS="-d32" |
70 |
fi |
71 |
unset JAVA_HOME |
72 |
JAVA="java" |
73 |
fi |
74 |
else |
75 |
JAVA_HOME="$JAVA_HOME_TO_USE" |
76 |
JAVA="$JAVA_HOME/bin/java" |
77 |
FORCE_JAVA_32BITS="-d32" |
78 |
fi |
79 |
echo "Using java $($WHICH $JAVA)" |
80 |
export JAVA_HOME |
81 |
export JAVA |
82 |
|
83 |
# Go into the gvSIG installation folder, just in case |
84 |
cd `dirname "$0"` |
85 |
|
86 |
# gvSIG installation folder |
87 |
GVSIG_HOME="$PWD" |
88 |
|
89 |
################################################################### |
90 |
# Variables not depending (at least directly) on the installation # |
91 |
################################################################### |
92 |
|
93 |
# gvSIG native libraries location |
94 |
GVSIG_NATIVE_LIBS=${GVSIG_HOME}/native:${HOME}/.depman/lib |
95 |
|
96 |
# Proj4 data files |
97 |
export PROJ_LIB="${GVSIG_HOME}/gvSIG/extensiones/org.gvsig.crs.extension/data" |
98 |
|
99 |
# GDAL data files |
100 |
export GDAL_DATA="${GVSIG_HOME}/data/gdal" |
101 |
|
102 |
# Native libraries path |
103 |
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GVSIG_NATIVE_LIBS" |
104 |
|
105 |
LIBRARIES="" |
106 |
# Load gvSIG Andami jars and dependencies for the classpath |
107 |
for i in ./lib/*.jar ; do |
108 |
LIBRARIES=$LIBRARIES:"$i" |
109 |
done |
110 |
for i in ./lib/*.zip ; do |
111 |
LIBRARIES=$LIBRARIES:"$i" |
112 |
done |
113 |
|
114 |
# echo Initial libraries found: ${LIBRARIES} |
115 |
|
116 |
# gvSIG Andami launcher |
117 |
if [ "$GVSIG_LAUNCHER" = "" ] ; then |
118 |
GVSIG_LAUNCHER=org.gvsig.andamiupdater.Updater |
119 |
fi |
120 |
if [ "$GVSIG_PARAMS" = "" ] ; then |
121 |
GVSIG_PARAMS="gvSIG gvSIG/extensiones $@" |
122 |
fi |
123 |
|
124 |
# gvSIG initial classpath |
125 |
GVSIG_CLASSPATH="$LIBRARIES:$GVSIG_CLASSPATH" |
126 |
|
127 |
######################## |
128 |
# Memory configuration # |
129 |
######################## |
130 |
|
131 |
# Initial gvSIG memory (M=Megabytes, G=Gigabytes) |
132 |
GVSIG_INITIAL_MEM=128M |
133 |
# Maximum gvSIG memory (M=Megabytes, G=Gigabytes) |
134 |
GVSIG_MAX_MEM=512M |
135 |
# Maximum permanent memory size: needed to load classes and statics |
136 |
GVSIG_MAX_PERM_SIZE=96M |
137 |
|
138 |
################ |
139 |
# Launch gvSIG # |
140 |
################ |
141 |
|
142 |
# Temporary fix for number locale related formatting error with proj4. |
143 |
export LC_NUMERIC=C |
144 |
|
145 |
# For Java parameters documentation and more parameters look at: |
146 |
# http://download.oracle.com/javase/6/docs/technotes/tools/windows/java.html |
147 |
# http://www.oracle.com/technetwork/java/javase/tech/vmoptions-jsp-140102.html |
148 |
|
149 |
echo Launching gvSIG: ${JAVA} \ |
150 |
$FORCE_JAVA_32BITS \ |
151 |
-Djava.library.path=/usr/lib:"${GVSIG_NATIVE_LIBS}" \ |
152 |
-cp $GVSIG_CLASSPATH \ |
153 |
-Xms${GVSIG_INITIAL_MEM} \ |
154 |
-Xmx${GVSIG_MAX_MEM} \ |
155 |
-XX:MaxPermSize=${GVSIG_MAX_PERM_SIZE} \ |
156 |
$GVSIG_LAUNCHER $GVSIG_PARAMS |
157 |
|
158 |
${JAVA} \ |
159 |
$FORCE_JAVA_32BITS \ |
160 |
-Djava.library.path=/usr/lib:"${GVSIG_NATIVE_LIBS}" \ |
161 |
-cp $GVSIG_CLASSPATH \ |
162 |
-Xms${GVSIG_INITIAL_MEM} \ |
163 |
-Xmx${GVSIG_MAX_MEM} \ |
164 |
-XX:MaxPermSize=${GVSIG_MAX_PERM_SIZE} \ |
165 |
$GVSIG_LAUNCHER $GVSIG_PARAMS |
166 |
|