views:

264

answers:

1

I have a groovy script that uses a third party library. Each time I open the application and attempt to run my script I have to import the proper library.

I would like to be able to open GroovyConsole and run my application without having to import the library.

A: 

At least on Linux groovy GroovyConsole is a Script has the Following command:

startGroovy groovy.ui.Console "$@"

startGroovy itself is a script which starts Java. Within the startGroovy script you should be able to modify your classpath and add the missing librarys.

From startGroovy:

startGroovy ( ) {
    CLASS=$1
    shift
    # Start the Profiler or the JVM
    if $useprofiler ; then
        runProfiler
    else
        exec "$JAVACMD" $JAVA_OPTS \
            -classpath "$STARTER_CLASSPATH" \
            -Dscript.name="$SCRIPT_PATH" \
            -Dprogram.name="$PROGNAME" \
            -Dgroovy.starter.conf="$GROOVY_CONF" \
            -Dgroovy.home="$GROOVY_HOME" \
            -Dtools.jar="$TOOLS_JAR" \
            $STARTER_MAIN_CLASS \
            --main $CLASS \
            --conf "$GROOVY_CONF" \
            --classpath "$CP" \
            "$@"
    fi
HaBaLeS