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.
0 个评论
回答(1 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!