Originally posted by: SongYang
Caused by: java.lang.RuntimeException: Native code library failed to load: ensure the appropriate library (opl124.dll/.so) is in your path.
This is the error message. I have already include the library but it still can not find these dlls. Could you please help me to fix it.
Thanks a lot.
Below is my .sh file
#!/bin/bash
#=================== eb.sh =====================
#PBS -l mem=6000mb,nodes=1:ppn=1,walltime=23:30:00
#PBS -m abe -M
user@tudelft.nl #PBS -o eb_${PBS_JOBID}.o
#PBS -e eb_${PBS_JOBID}.e
#PBS -V
cd ${PBS_O_WORKDIR}
LD_LIBRARY_PATH=/home/syang/data/ILOG/CPLEX_Studio_Academic124/opl/bin/x86_win32/
export LD_LIBRARY_PATH
export ILOG_LICENSE_FILE=/home/syang/data/ilm/access.ilm
java -Djava.library.path=/home/syang/data/ILOG/CPLEX_Studio_Academic124/opl/bin/x86_win32 -jar /home/syang/data/TestServer/TestCplex.jar &> /home/syang/data/TestServer/outConsole.txt
#================================================
This is my Java program which can normally run on my computer, but it has errors in the cluster.
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package testserver;
import ilog.concert.*;
import ilog.cplex.*;
import ilog.opl.*;
import java.io.*;
/**
*
* @author songyang
*/
public class TestServer {
public static void main(String[] args) {
try
{
IloOplFactory.setDebugMode(true);
IloOplFactory oplF = new IloOplFactory();
IloOplErrorHandler errHandler = oplF.createOplErrorHandler(System.out);
IloOplSettings settings = oplF.createOplSettings(errHandler);
IloOplModelSource modelSource = oplF.createOplModelSource("/home/syang/data/TestServer/Java.mod");
IloOplModelDefinition def = oplF.createOplModelDefinition(modelSource,settings);
IloCplex cplex = oplF.createCplex();
IloOplDataSource dataSource= oplF.createOplDataSource("/home/syang/data/TestServer/Java.dat");
IloOplModel opl = oplF.createOplModel(def, cplex);
opl.addDataSource(dataSource);
double objective_result;
IloOplRunConfiguration rc = oplF.createOplRunConfiguration(opl.getModelDefinition(), opl.makeDataElements());
rc.getCplex().setOut(null);
rc.getOplModel().generate();
double opx;
if (rc.getCplex().solve())
{
objective_result = rc.getOplModel().getCplex().getObjValue();
System.out.println("The optimum value is:");
System.out.println(objective_result);
BufferedWriter bw = new BufferedWriter(new FileWriter("/home/syang/data/TestServer/result111.txt"));
String str=String.valueOf(objective_result);
bw.write(str);
bw.close();
IloOplDataElements myData;
//myData= rc.getOplModel().makeDataElements();
IloOplElement myVariable = rc.getOplModel().getElement("bb");
double mymap = myVariable.asNum();
IloOplElement yrVariable=rc.getOplModel().getElement("aa");
IloNumMap array=yrVariable.asNumMap();
double aa=array.getSub(1).get(1);
System.out.println("myDecVarible = " + mymap);
System.out.println("array variable"+aa);
}
else
{
System.out.println("No solution!");
System.out.flush();
}
//opx=map.get(1);
//System.out.println(opx);
rc.end();
rc = null;
}catch( Exception e) {
e.printStackTrace();
}
// TODO code application logic here
}
}
#CPOptimizer#DecisionOptimization