java.lang.UnsatisfiedLinkError: no jhdf5 in java.library.path

blayfk
blayfk used Ask the Experts™
on
hi
I  have some .dll files(jhdf5.dll and jhdf.dll) in win folder I will like to load on windows XP.
I first tried the following two setups  in my batch file but I'm still getting errors

1. java -Djava.library.path=./plugins/ncsa.hdf/resources/win/
2. java -Djava.library.path=C:/myProduct/plugins/ncsa.hdf/resources/win/

Can someone tells me whats wrong with my settings
      
java.lang.UnsatisfiedLinkError: no jhdf5 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 ncsa.hdf.hdf5lib.H5.<clinit>(H5.java:234)
        at ncsa.hdf.hdf5lib.HDF5Constants.<clinit>(HDF5Constants.java:494)
        at ncsa.hdf.object.h5.H5File.<init>(H5File.java:167)
        at ncsa.hdf.object.h5.H5File.<init>(H5File.java:106)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
a_b
Top Expert 2009

Commented:
Your lib path is incorrect - http://www.hdfgroup.org/hdf-java-html/hdf-object/use.html#libpath

Check the link and see the path as it dependent on the OS
Top Expert 2016
Commented:
Try

 java -Djava.library.path=./plugins/ncsa.hdf/resources/win/;C:/myProduct/plugins/ncsa.hdf/resources/win/
Angular Fundamentals

Learn the fundamentals of Angular 2, a JavaScript framework for developing dynamic single page applications.

Top Expert 2016

Commented:
No. Try
 java -Djava.library.path=.\plugins\ncsa.hdf\resources\win\;C:\myProduct\plugins\ncsa.hdf\resources\win

Open in new window

Top Expert 2016

Commented:
I would make both paths absolute though

Commented:
Also check follwonig
 
if you are using System.load(...), pass the complete file name with extension and path

Alternatively you can use System.loadLibrary(...),where you do not pass the library extension, just add your library path to java -Djava.library.path

and try
>>java -Djava.library.path=./plugins/ncsa.hdf/resources/win/
java -Djava.library.path=C:/myProduct/plugins/ncsa.hdf/resources/win/
>>

you have to combine above and pass it as vm arguments in the app launch command! for e.g.,

java -Djava.library.path=C:\myProduct\plugins\ncsa.hdf\resources\win\;C:\myProduct\plugins\ncsa.hdf\resources\win "CALSSPATH HERE" "YOUR STARTUPCLASS"

Author

Commented:
a_b,
      your link is helpful but what I want to do is set these .dll in my application so that a user will run the application straight away but not necessarily setting the environmental variables. I run my application from run.bat or .exe files.

Commented:
then you set environment variables in your bat file. Keep your libraries in your JDK lib folder.
I believe any way you will be providing JAVA_HOME.
Commented:
This solved the problem for me.
java -Djava.library.path=./plugins/ncsa.hdf/resources/win/  startup.jar

In addition this I needed to install C++ runtime on my machine. One can get more details from
http://mail.hdfgroup.org/pipermail/hdf-forum_hdfgroup.org/2010-January/002445.html


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial