my dog learned polymorphism*
The moose likes Linux / UNIX and the fly likes Launching Jar Files on Linux Cluster Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Launching Jar Files on Linux Cluster " Watch "Launching Jar Files on Linux Cluster " New topic
Author

Launching Jar Files on Linux Cluster

Dal Upei
Greenhorn

Joined: Aug 03, 2004
Posts: 1
I have been trying to get a program I have written working on a Linux based cluster computer at my university. We have set up the JRE on the cluster and have confirmed that it works. However when I try to use my script to ssh into several nodes and run the java command it never works, all it returns is:

bash: java: command not found

This is my script:

#!/bin/bash
#!/bin/usr/java/j2re1.4.2_05/bin/java
thread=0
for node in 15 16 17 18 19; do
ssh compute-0-${node} java -jar -Xmx750m SimPLNode.jar parameters.dat /rack0/node-${node}/results-${node}.res /rack0/node-${node}/status-${node}.sts /rack0/node-${node}/error-${node}.log 20000 ${thread} ${thread}+1
thread=${thread}+2
done

Hope someone can help, Thanks

Andr�.
Dirk Schreckmann
Sheriff

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch!

I'm not a strong Linux user, I just play a weak one with my web server and in my wiki.

Could your problem be simply that the PATH isn't properly specified to include the java executable (which starts the JVM)? On my web server, I edited the /etc/profile (which gets run at start up) to include the following lines.

JAVA_HOME=/usr/java/j2sdk1.4.2_04
PATH=$JAVA_HOME/bin:$PATH
export JAVA_HOME PATH (and some other environment variables)

Then, running java from any working directory works fine.


[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
Stefan Wagner
Ranch Hand

Joined: Jun 02, 2003
Posts: 1923

Originally posted by Andr�:

#!/bin/bash
#!/bin/usr/java/j2re1.4.2_05/bin/java

I never saw this notation (a second line of the form '#!...') before.

And I don't use clusters (being a kind of fossil ).
But I guess Dirk is right.


http://home.arcor.de/hirnstrom/bewerbung
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15957
    
  19

The trick is that Andre's trying to run these processes remotely. Meaning, that on each node, there has to be a JRE. Just because the client has a JRE doesn't make it available to remote nodes.

The best way to make this work is to either ensure that each node has a JRE installed, or, alternatively, install a JRE in a shared mountpoint. Then code the remote request accordingly. E.g.:

/shared/java/j2sdk_1.4.1_02/bin/java -jar ...
[ August 06, 2004: Message edited by: Tim Holloway ]

Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Launching Jar Files on Linux Cluster
 
Similar Threads
linux cron task to invoke java class
Weblogic on linux installation problem
script runs from command line, but from webmin it creates errors
Problem when executing the LWJGL native library under Java via shell script
unix script for executing jar file thrice a day...