[jsword-devel] JSword v1.0 beta 1

Mark Goodwin jsword-devel@crosswire.org
23 Apr 2003 12:09:10 +0100


You'll want to change those backslashes in the last line to slashes.....

But yeah, once you've done that it seems to work fine.

MarkG

On Mon, 2003-04-21 at 17:23, Joe Walker wrote:
> 
> Hi,
> 
> Thanks, I've been meaning to hack up the unix ant startup script for 
> jsword. (The DOS batch file is vaguely inspired by the windows ant 
> startup script).
> 
> The attached is a vague attempt, please could you have a go?
> 
> In theory it should work on cgywin/maxosx and not need updating whenever 
> the number of jars changes.
> 
> Joe.
> ----
> 

> #!/bin/sh
> 
> # Parts of this file were derived from the ant startup script for unix.
> # Copyright (c) 2001-2003 The Apache Software Foundation.
> 
> # OS specific support.  $var _must_ be set to either true or false.
> cygwin=false;
> darwin=false;
> case "`uname`" in
>   CYGWIN*) cygwin=true ;;
>   Darwin*) darwin=true
>            if [ -z "$JAVA_HOME" ] ; then
>              JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home   
>            fi
>            ;;
> esac
> 
> if [ -z "$JSWORD" ] ; then
>   ## resolve links - $0 may be a link to jsword's home
>   PRG="$0"
>   progname=`basename "$0"`
>   saveddir=`pwd`
> 
>   # need this for relative symlinks
>   dirname_prg=`dirname "$PRG"`
>   cd "$dirname_prg"
>   
>   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
>   
>   JSWORD=`dirname "$PRG"`/..
> 
>   cd "$saveddir"
> 
>   # make it fully qualified
>   JSWORD=`cd "$JSWORD" && pwd`
> fi
> 
> # For Cygwin, ensure paths are in UNIX format before anything is touched
> if $cygwin ; then
>   [ -n "$JSWORD" ] &&
>     JSWORD=`cygpath --unix "$JSWORD"`
>   [ -n "$JAVA_HOME" ] &&
>     JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
>   [ -n "$CLASSPATH" ] &&
>     CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
> fi
> 
> if [ -z "$JAVACMD" ] ; then 
>   if [ -n "$JAVA_HOME"  ] ; then
>     if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 
>       # IBM's JDK on AIX uses strange locations for the executables
>       JAVACMD="$JAVA_HOME/jre/sh/java"
>     else
>       JAVACMD="$JAVA_HOME/bin/java"
>     fi
>   else
>     JAVACMD=`which java 2> /dev/null `
>     if [ -z "$JAVACMD" ] ; then 
>         JAVACMD=java
>     fi
>   fi
> fi
> 
> if [ ! -x "$JAVACMD" ] ; then
>   echo "Error: JAVA_HOME is not defined correctly."
>   echo "  We cannot execute $JAVACMD"
>   exit 1
> fi
> 
> if [ -n "$CLASSPATH" ] ; then
>   LOCALCLASSPATH="$CLASSPATH"
> fi
> 
> # This is actually redundant because we are using the endorsed.dirs method
> # (which we need for JAXB purposes)
> for i in "${JSWORD}/lib/"*.jar
> do
>   # if the directory is empty, then it will return the input string
>   # this is stupid, so case for it
>   if [ -f "$i" ] ; then
>     if [ -z "$LOCALCLASSPATH" ] ; then
>       LOCALCLASSPATH="$i"
>     else
>       LOCALCLASSPATH="$i":"$LOCALCLASSPATH"
>     fi
>   fi
> done
> 
> # For Cygwin, switch paths to Windows format before running java
> if $cygwin; then
>   JSWORD=`cygpath --windows "$JSWORD"`
>   JAVA_HOME=`cygpath --windows "$JAVA_HOME"`
>   CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
>   LOCALCLASSPATH=`cygpath --path --windows "$LOCALCLASSPATH"`
>   CYGHOME=`cygpath --windows "$HOME"`
> fi
> 
> "$JAVACMD" "-Djava.endorsed.dirs=${JSWORD}\lib" -classpath "${JSWORD}\resource" "-Djsword.bible.dir=${JSWORD}\resource" org.crosswire.jsword.view.swing.desktop.Desktop