Appendix A. Running client programs from command line

Sometimes it might be necessary to run a Java program directly using the java executable. There are two recommended ways of doing so (the GLOBUS_LOCATION environment variable must first be set in both cases):

[Important]Important

If you are not using any of these two methods please take a look at Appendix B, Running client programs from any directory.

1. With globus-devel-env script help

The globus-devel-env script can be used to set the proper CLASSPATH environment variable. To set the CLASSPATH on Windows execute:

 > %GLOBUS_LOCATION%\etc\globus-devel-env.bat

On Unix/Linux machines execute (for bash/sh):

 $ . $GLOBUS_LOCATION/etc/globus-devel-env.sh

or (for csh/tcsh):

 $ source $GLOBUS_LOCATION/etc/globus-devel-env.csh

Once the globus-devel-env is executed successfully run the Java program, for example:

On Windows:

 > java -DGLOBUS_LOCATION=%GLOBUS_LOCATION% foo.MyClass

On Unix/Linux:

 $ java -DGLOBUS_LOCATION=$GLOBUS_LOCATION foo.MyClass

Note: Passing -DGLOBUS_LOCATION is not necessary but will enable the client to execute from any directory.

2. Using bootstrap

Sometimes the above method might fail if the CLASSPATH environment variable is too long for the OS to handle. With the bootstrap method, a bootstrap code is executed first which sets the classpath programmatically and then invokes the specified Java program. To invoke a Java program on Windows through bootstrap execute:

 > java -cp %GLOBUS_LOCATION%\lib\bootstrap.jar
    -DGLOBUS_LOCATION=%GLOBUS_LOCATION% \ org.globus.bootstrap.Bootstrap foo.MyClass

On Unix/Linux machines execute:

 $ java -cp $GLOBUS_LOCATION/lib/bootstrap.jar -DGLOBUS_LOCATION=$GLOBUS_LOCATION \
    org.globus.bootstrap.Bootstrap foo.MyClass