Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Launching Jar Files on Linux Cluster

 
Dal Upei
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Stefan Wagner
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17989
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic