简体   繁体   中英

How to load a java class to HPC?

I am new to HPC computing. I am trying to run am file through HPC. In my code I need to connect an oracle database. So the related code part is as below:

javaaddpath('ojdbc6.jar');
javaaddpath('orai18n.jar');
javaaddpath('ojdl.jar');

conn=database('bdb','USER','PASSW','oracle.jdbc.driver.OracleDriver','HOST_NAME');

I have already pasted related jar files to the related folder and loaded Java/1.7.0_51. Additionally, I can connect to the database when I work on GUI in HPC. However, when I try to run it through a job I got an error as follows:

{Undefined variable "com" or class
"com.mathworks.jmi.ClassLoaderManager.getClassLoaderManager".

Error in javaclasspath>local_javapath (line 132)
jloader = com.mathworks.jmi.ClassLoaderManager.getClassLoaderManager;

Error in javaclasspath (line 68)
  p = local_javapath('-dynamic');

Error in javaaddpath (line 71)


javaclasspath( p, javaclasspath );

Error in amk (line 1)
javaaddpath('ojdbc6.jar');

}

So how shall I handle this issue?

Here was my previous bash file:

#!/bin/bash -l

# The name of your job (used in mail, outputfile, showq,...)
#PBS -N matlab_test_job

# Set the correct environment for matlab
module load matlab

# Go into the directory from where 'qsub' was run
cd $PBS_O_WORKDIR

# Start matlab, specify the correct command-file ...
matlab -nojvm -nodisplay -r amk

When a java class is desired to invoke, started MATLAB with the -nojvm option will hinder related jar files to be used. So when I removed -nojvm option, my code worked..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM