Green Grid Project
Project Home
Project Background
MDS Data
Presentations
Downloads

Campus Grid Resources
grid-mapfile
Dartmouth CA
fMRIDC Grid
CGL Discovery Cluster




Application Notes :: Java on the Grid




Submit/Shell Script

#!/bin/sh

echo "-------------------------------------------------------------------"
echo "Starting job at `date` on host `hostname`"

#
# Transfer over our class file and execute locally
#

HDIR="/afs/dbic.dartmouth.edu/usr/gazzaniga/jed/Grid/examples/java"

# Copy from AFS to local storage
cp ${HDIR}/HelloGrid.class .

# Execute code in JVM (Sun JVM)
/usr/bin/java HelloGrid
echo "Exit Status: $?"

# Cleanup
rm HelloGrid.class

echo "Finished job at `date` on host `hostname`"
echo "-------------------------------------------------------------------"

     
java_hello.sh


Sample Java Code

public class HelloGrid
{
    public static void main( String[] args ) 
    {
        System.out.println("Hello, World!");
    }

}

     
HelloGrid.java


Output

[jed@mitral java]$ globus-job-run cs-01.grid -stage hello_grid.sh
-------------------------------------------------------------------
Starting job at Tue Sep 28 10:45:10 EDT 2004 on host cs-01.grid.dartmouth.edu
Hello, World!
Exit Status: 0
Finished job at Tue Sep 28 10:45:10 EDT 2004 on host cs-01.grid.dartmouth.edu
-------------------------------------------------------------------
     
Output
$Id: application_java.php,v 1.1 2004/09/28 15:57:31 jed Exp jed $