This week's book giveaways are in the AI and JavaScript forums.
We're giving away four copies each of GANs in Action and WebAssembly in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of GANs in ActionE this week in the AI forum
or WebAssembly in Action in the JavaScript forum!
  • 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
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

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: 21579
146
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 ]
 
Mo-om! You're embarassing me! Can you just read a tiny ad like a normal person?
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!