jQuery in Action, 3rd edition
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

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Launching Jar Files on Linux Cluster " Watch "Launching Jar Files on Linux Cluster " New topic

Launching Jar Files on Linux Cluster

Dal Upei

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:

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

Hope someone can help, Thanks

Dirk Schreckmann

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.

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�:


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.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17256

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 ]

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: Launching Jar Files on Linux Cluster
jQuery in Action, 3rd edition