Error occured: when I try to use java to call the matlab jar on linux.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
yunlong xiang
am 7 Mai 2021
Beantwortet: Shiva Kalyan Diwakaruni
am 12 Mai 2021
I wrote a matlab function and packaged it into a jar package through DEPLOYTOOL. I write java program on Windows, import the package and run it successfully. When I put the same jar package and Java program on Linux for execution, an error occurred:
Exception: com.mathworks.toolbox.javabuilder.MWException: An error occurred while initializing the component.
"Application not supported on Linux due to platform dependencies. Intended platforms include: Windows. For more information, please contact the application author."
Exception in thread "main" java.lang.NullPointerException
at com.gpr.demo.gprPredict.main(gprPredict. java:44 )
below is my java code:
package com.gpr.demo;
import com.mathworks.toolbox.javabuilder.*;
import demo_TrainTest.gplModel;
public class gprTrain {
public static void main(String[] args){
MWNumericArray mwa = null;
Object[] result = null;
gplModel dtrain = null;
try{
String filename = "F:/0326_temperature.txt";
String fileoutput = "gprmdl.mat";
dtrain = new gplModel();
dtrain.demoTrain(filename,fileoutput);
}
catch(Exception e){
System.out.println("Exception: " + e.toString());
}
finally{
MWArray.disposeArray(mwa);
MWArray.disposeArray(result);
dtrain.dispose();
}
}
}
0 Kommentare
Akzeptierte Antwort
Shiva Kalyan Diwakaruni
am 12 Mai 2021
Hi,
The compiled applications are not cross-platform compatible (cannot go from Windows to Linux)
Inner-platform compatibility exists (can go from one supported Windows to another supported Windows)
JARs generated using Builder JA are generally platform independent, only if they do not use MEX files internally (as those are platform dependent)
Hope it helps.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Java Package Integration finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!