Skip to content

Instantly share code, notes, and snippets.

@gimsieke
Created November 3, 2012 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gimsieke/4007510 to your computer and use it in GitHub Desktop.
Save gimsieke/4007510 to your computer and use it in GitHub Desktop.
dtdanalyzer frontend script for Cygwin + Windows Java
#!/bin/bash
cygwin=false;
case "`uname`" in
CYGWIN*) cygwin=true;
esac
# Figure out DTDANALYZER_HOME, which is the directory in which this script
# resides.
DTDANALYZER_HOME="$( cd -P "$(dirname $( readlink -f "${BASH_SOURCE[0]}" ))" && pwd )"
# Add the build directory to the classpath. This script is used both by
# developers and users. For developers, the .class files in the build
# directory will be found first. Users don't have a build directory.
CP="$DTDANALYZER_HOME/build"
# Add all the .jar files in the lib subdirectory to the classpath
for jar in "$DTDANALYZER_HOME"/lib/*.jar "$DTDANALYZER_HOME"/lib/*/*.jar
do
CP="$CP:$jar"
done
if $cygwin; then
CP="$(cygpath -map "$CP")"
DTDANALYZER_HOME="$(cygpath -ma "$DTDANALYZER_HOME")"
fi
# We're not using log4j yet, but we might in the future. Until then, this
# shouldn't do any harm.
LOGCONFIG=${LOGCONFIG:-file:"$DTDANALYZER_HOME"/etc/log4j.properties}
# And, execute! Setting the DTDANALYZER_HOME system property so that
# the utility can find supplementary files like XSLT, CSS and JS.
exec java -cp "$CP" -Xmx256M "-Dlog4j.configuration=${LOGCONFIG}" \
"-DDTDANALYZER_HOME=$DTDANALYZER_HOME" \
gov.ncbi.pmc.dtdanalyzer.DtdAnalyzer "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment