• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Launching Jar Files on Linux Cluster

 
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�.
 
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.
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • 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.
 
Saloon Keeper
Posts: 22504
151
Android Eclipse IDE Tomcat Server Redhat Java 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 ]
 
I don't even know how to spell CIA. But this tiny ad does:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic