Program works in 2008 but not in 2012

I write a program to control Ocean optics spectrum analyzer through usb.
OmniDriverJarFilePath = 'C:\Program Files\Ocean Optics\OmniDriver
\OOI_HOME\OmniDriver.jar';
OmniDriverJavaClass = 'com.oceanoptics.omnidriver.api.wrapper.Wrapper';
spectrometerIndex = 0;
MatlabJavaClassPath = javaclasspath;
if(isempty(MatlabJavaClassPath))
javaaddpath(OmniDriverJarFilePath);
end
import(OmniDriverJavaClass);
clear wrapper
wrapper = Wrapper(); % used when called by a function
numoospec = wrapper.openAllSpectrometers();
It works well in m Matlab 2008, however, when I try to run it in Matlab 2012, it show error at the last command.
Java exception occurred:
java.lang.UnsatisfiedLinkError:
com.oceanoptics.uniusb.UniUSB.NatUSBGetInterfaceDescriptor(JLcom/oceanoptics
/uniusb/USBInterfaceDescriptor;)V
at com.oceanoptics.uniusb.UniUSB.NatUSBGetInterfaceDescriptor(Native Method)
at com.oceanoptics.uniusb.UniUSB.openDevice(UniUSB.java:106)
Does anybody know what's going on? Thanks a lot.

 채택된 답변

Friedrich
Friedrich 2013년 4월 10일
편집: Friedrich 2013년 4월 10일

0 개 추천

Hi,
seems like a DLL cant be found from the JAVA code. I guess you modified the librarypath.txt in 2008 in order to add the folder where the needed DLL is located. Did you do that on 2012 also? You can type
edit librarypath.txt
in MATLAB to open that file. Compare that to the 2008.
Alternativly, did the bittedness changed? In the case you moved from 32bit 2008 to 64bit 2012 you need to make sure to get the needed DLL as 64bit DLL.

댓글 수: 1

Ruxin Xie
Ruxin Xie 2013년 4월 10일
I check them. They are different. But after changing that, it still does not work. I check the java version, for 2008 is 1.6.0, for 2012 is 1.6.0_17-b0. I think this might be a problem. I'm trying to math them. Thank you.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by