Project

General

Profile

Revision 8020

allow running the Harvester client without a source code checkout. (D. Blankman comments)

View differences:

runHarvester.sh
1
METACAT_CLASSES=$METACAT_HOME/build/classes
2
METACAT_LIB=$METACAT_HOME/lib
3
JDBC=$METACAT_HOME/build/war/lib/jdbc.jar:$METACAT_LIB/postgresql-8.0-312.jdbc3.jar
4
LIB_JARS=$METACAT_LIB/cos.jar:$METACAT_LIB/xercesImpl.jar:$METACAT_LIB/utilities.jar:$METACAT_LIB/log4j-1.2.12.jar:$METACAT_LIB/xalan.jar
5
export CLASSPATH=$METACAT_CLASSES:$JDBC:$LIB_JARS
6
cd $METACAT_CLASSES
7
java edu.ucsb.nceas.metacat.harvesterClient.Harvester
1
#!/bin/sh
2
#
3
# Shell script for launching Metacat Harvester from unix systems
4
#
5
# '$RCSfile: morpho,v $'
6
# '$Author$'
7
# '$Date$'
8
# '$Revision$'
9

  
10
# use java launcher under JAVA_HOME if set, otherwise try search path
11
if [ -n "$JAVA_HOME" ]; then
12
    if [ ! -d "$JAVA_HOME" ]; then
13
        echo "Error: JAVA_HOME is not a valid directory"
14
        exit 1
15
    fi
16
    JAVA_HOME="$( cd $JAVA_HOME ; pwd -P )"
17
    echo "Using JAVA_HOME=$JAVA_HOME"
18
    JAVA_BIN="$JAVA_HOME/bin/java"
19
    ERR="Your JAVA_HOME does not contain bin/java"
20
else
21
    JAVA_BIN="$(command -v java)"
22
    echo "No JAVA_HOME variable set"
23
    ERR="JAVA_HOME was not set, and no other java was found on your path"
24
fi
25
if [ -f "$JAVA_BIN" ]; then
26
    echo "Attempting to use java launcher $JAVA_BIN"
27
else
28
    echo "Error: $ERR"
29
    exit 1
30
fi
31
echo "----------------------------------"
32
"$JAVA_BIN" -version || exit 1
33
echo "----------------------------------"
34

  
35
LIB=$METACAT_HOME/WEB-INF/lib
36

  
37
# generate classpath, with some error checking
38
CPATH="."
39
for JAR in $LIB/*.jar; do
40
    [ -f "$JAR" ] || continue
41
	CPATH="$CPATH:$JAR"
42
done
43
if [ -z "$CPATH" ]; then
44
    echo "Error: No Morpho JAR files found in $LIB"
45
    exit 1
46
fi
47
echo "Using dynamic classpath: $CPATH"
48

  
49
# launch it
50
"$JAVA_BIN" -cp "$CPATH" edu.ucsb.nceas.metacat.harvesterClient.Harvester $1

Also available in: Unified diff