Java Error when using compiled matlab code (GUI) using the Instrument Control Toolbox

조회 수: 3 (최근 30일)
Hello,
I'm trying to compile and use an EXE of a Matlab GUI that I've written to control a few instruments and run an automated data collection cycle on a long term test. The code works fine as a *.m, however it stops and spits out a java error when I run it compiled. The error comes out thus:
C:\...\exetest>VoltageRamp
C:\...\exetest>Error using instrhwinfo (line 152)
Java exception occurred:
java.lang.NoClassDefFoundError: com/sun/jna/Library
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.mathworks.toolbox.testmeas.util.mwSystem.silenceLoadLibrary(mwSystem.java:20)
at com.mathworks.toolbox.testmeas.util.mwSystem.silence(mwSystem.java:27)
at com.mathworks.toolbox.testmeas.util.mwSystem.load(mwSystem.java:42)
at com.mathworks.toolbox.instrument.GpibDll.findValidAdaptors(GpibDll.java:783)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Library
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 16 more
Error in setupPS (line 9)
Error in VoltageRamp>btnStart_Callback (line 422)
Error in gui_mainfcn (line 96)
Error in VoltageRamp (line 43)
Error in @(hObject,eventdata)VoltageRamp('btnStart_Callback',hObject,eventdata,guidata(hObject))
Error while evaluating uicontrol Callback
The code for setupPS looks like this:
function setupPS( ipAdd )
%SETUPPS Summary of this function goes here
% addr = GPIB address of the supply
c=strsplit(num2str(ipAdd),'.');
hware=instrhwinfo;
if ~isempty(find(ismember(hware.SupportedInterfaces,'gpib')))
hware=instrhwinfo('gpib');
end
if ~isempty(find(ismember(hware.InstalledAdaptors,'ni')))
hware=instrhwinfo('gpib','ni');
end
...
That code continues, but error was at line 9 above
Now the only thing else that I find worth even mentioning is that I'm compiling this on a different computer than I'm attempting to run the *.exe on. However that shouldn't matter (afaik), both have exactly the same NI driver sets, both computers have exactly the same version of Java on them. I have not tried simply compiling setupPS to exe and running that, but that seemed a fruitless diagnostic path to me.
Any help would be greatly appreciated.

답변 (1개)

Dasharath Gulvady
Dasharath Gulvady 2015년 7월 21일

카테고리

Help CenterFile Exchange에서 Data Acquisition Toolbox Supported Hardware에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by