Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: UnsatisfiedLinkError from Matlab code

  1. #1
    Junior Member
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default UnsatisfiedLinkError from Matlab code

    EDIT: Nevermind, fixed the problem. Matlab needed an additional file in it's bin directory to point to the java libraries. Mod can delete this message if it's not useful.


    Hi All,

    I'm trying to interface a spectrometer (Ocean Optics USB2000+) with matlab via a wrapper that calls java libraries. The java methods and the wrapper class seem to load into matlab fine, but when I try to send a command to the spectrometer it gives me the following error:

    ??? Java exception occurred:
    java.lang.UnsatisfiedLinkError: no NatUSB in java.library.path

    at java.lang.ClassLoader.loadLibrary(Unknown Source)

    at java.lang.Runtime.loadLibrary0(Unknown Source)

    at java.lang.System.loadLibrary(Unknown Source)

    at com.oceanoptics.uniusb.UniUSB.<clinit>(UniUSB.java :56)

    at com.oceanoptics.omnidriver.features.USBImpl.<init> (USBImpl.java:62)

    at
    com.oceanoptics.omnidriver.spectrometer.USBSpectro meter.<init>(USBSpectrometer.java:96)

    at
    com.oceanoptics.omnidriver.spectrometer.mayapro200 0.MayaPro2000.<init>(MayaPro2000.java:167)

    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)

    at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(Unknown Source)

    at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(Unknown Source)

    at java.lang.reflect.Constructor.newInstance(Unknown Source)

    at java.lang.Class.newInstance0(Unknown Source)

    at java.lang.Class.newInstance(Unknown Source)

    at
    com.oceanoptics.omnidriver.spectrometer.Spectromet erFactory.getAllSpectrometers(SpectrometerFactory. java:193)

    at
    com.oceanoptics.omnidriver.api.wrapper.Wrapper.ope nAllSpectrometers(Wrapper.java:501)


    I suppose that this means java can't find the library 'NatUSB.dll', but I have confirmed that this dll exists and that the PATH environment variable has a pointer to the directory where it is located. What else might have gone wrong here?

    Thanks!
    Last edited by RandalF; August 17th, 2011 at 06:20 PM.


  2. #2
    Junior Member
    Join Date
    Aug 2011
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: UnsatisfiedLinkError from Matlab code

    EDIT: Found it, NatUSB.dll should be in bin\win32
    this self-fixing thread might be closed

    Hi RandalF,

    I'm facing the same exception when trying to interface with an Ocean Optics HR4000 with Matlab. Could you tell me which additional file Matlab needs and where is should be saved?

    Thank in advance!
    Last edited by EvB; August 18th, 2011 at 01:40 AM.

  3. #3
    Junior Member
    Join Date
    Aug 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: UnsatisfiedLinkError from Matlab code

    Hi EvB,

    I see that you fixed it, but just for the benefit of anyone who comes along this thread, I added a file, librarypath.txt in Matlab's startup directory with a pointer to the directory where the Omnidriver DLLs are located. This is discussed under "Locating Native Method Libraries" here: Bringing Java Classes and Methods into MATLAB Workspace :: Using Java Libraries from MATLAB (MATLAB)

Similar Threads

  1. Help ! java.lang.UnsatisfiedLinkError
    By CTheSky in forum Java Theory & Questions
    Replies: 1
    Last Post: July 7th, 2011, 12:50 PM
  2. [SOLVED] UnsatisfiedLinkError
    By tecno40 in forum Java Native Interface
    Replies: 5
    Last Post: June 12th, 2011, 03:08 AM
  3. UnsatisfiedLinkError
    By leepan2008 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: January 6th, 2011, 11:39 PM
  4. java.lang.UnsatisfiedLinkError
    By H P in forum Java Native Interface
    Replies: 3
    Last Post: January 28th, 2010, 05:04 AM

Tags for this Thread