1
votes

I would like to submit a job in the hpc and the job is running a java application. I edit the pbs_script files as following: #/bin/sh #PBS -q serial #PBS -l nodes=1:ppn=4 module load java-jdk/1.7.0-17 java myjavapp

I submitted the job $qsub pbs_script however the job return a error: could not find or load main class myjava. but I use the same command to run the java program under the command-line. what is the problem?

3

3 Answers

0
votes

Problems such as this one are almost always a difference in the environment of where the job executes versus where you're executing it on the command line. To track it down you usually only need to check that everything is available on all of the nodes in the cluster and that the environment is configured such that the shell which runs the job will find what you're looking for.

0
votes

Usually this is due not finding the class file. In PBS, the submit script starts execution from the user's home directory, not where you submitted the job. It is often useful to include the following line:

cd $PBS_O_WORKDIR

The command changes the directory on the execute node to the directory that the job was submitted from. Therefore, if you are able to run java myjavapp from the directory that you are submitting from (issuing the qsub), then the $PBS_O_WORKDIR line should work.

Your final submit file would look something like:

#/bin/sh 
#PBS -q serial 
#PBS -l nodes=1:ppn=4 
module load java-jdk/1.7.0-17
cd $PBS_O_WORKDIR
java myjavapp
0
votes

We face the same problem today. We can run the java scripts on both master and nodes but when we submit the script through PBS, it fails. The error message is as the same as yours. We fix the problem by giving the java program the classpath.

java -classpath myjava

Then, the qsub submitted java script can run on any node of the server. : )

Bo