Use MKS Java Api from MATLAB
- October 16, 2015
- 2 replies
- 2563 views
Hello PTC community,
i'm trying to call the MKS Java Api from MATLAB (Release 2010b 32 bit).
This is because I want to avoid having an external java-class since our main code is all in MATLAB and running Java classes in Matlab was never an issue before.
It all looks good at the beginning, however, when running the cmdRunner-Class, i encounter a Java exception.
Below is an excerpt of the code (MATLAB M-File format) that i'm trying to run. The full m-file with more information is also attached.
When I run the same code from an external Java class in the JRE, everything is working fine. (Thus it shouldn't be the connection to the server)
Is there somebody who could help me with this? Any help would be greatly appreciated.
Thanks,
Stefan
javaaddpath('C:\Matlab\WORK\mksapi.jar');
javaclasspath('-dynamic');
import java.util.List;
import com.mks.api.*
import com.mks.api.response.*;
import com.mks.connect.*;
ipf = IntegrationPointFactory.getInstance();
APIVersion=util.APIVersion(4,11); % Was also tested with 4,15
IntegrationPoint = ipf.createIntegrationPoint('SERVERNAME',7001,true,APIVersion);
Session = IntegrationPoint.createSession('USERNAME','PASSWORD');
CmdRunner = Session.createCmdRunner();
% CmdRunner-Test:
CmdRunner.toString()
% Answer:
% com.mks.connect.HttpCmdRunnerImpl@2bce4f
cmd = Command(Command.SI,'about');
resp = CmdRunner.execute(cmd);
% Answer:
% ??? Java exception occurred:
%
% (no more information...)
