4

This exception is arising when I am running my program for smart card reading. My device is not connected. Please help me.

JDGuide
  • 6,239
  • 12
  • 46
  • 64

2 Answers2

17

This means it could not load a shared library you need. This could be because.

  • The library is not in your library path.
  • The library does not have the right name e.g. LIBRARY must be libLIBRARY.so on Unix
  • The library is not executable by you.
  • The library is not for the OS or bit size of your JVM. e.g. a 64-bit JVM will not load a 32-bit library.
  • Your JRE is not installed correctly and it is failing to load one of its own libraries.
  • You are using a shared library which needs another shared library you don't have.
  • The DLL wasn't build as a JNI library or used from JNA.
pb2q
  • 58,613
  • 19
  • 146
  • 147
Peter Lawrey
  • 525,659
  • 79
  • 751
  • 1,130
  • Thanks for your answer. But i am using a .dll file for read the smart card.I am just loading that dll file. – JDGuide Aug 06 '12 at 09:30
  • All the suggestions I made still apply. – Peter Lawrey Aug 06 '12 at 09:35
  • @soljava You can't just load a dll file like that from Java. Either it must be a JNI dll or you must use JNA (or something similar if that exists...). – maba Aug 06 '12 at 09:47
  • @maba oh, you can load it into the Java process with too much problems (if it does have all the properties that pb2q mentioned. It's communicating afterwards with it that's the trick :) – Maarten Bodewes Aug 13 '12 at 22:12
0

I got this when using System.loadLibrary which will use the java.libary.path resource. Since absolute path isn't allowed by loadLibrary, you can use the absolute path and load method.

    System.load(HelloWorld.class.getResource("/dlls/HelloWorld.dll")
            .getPath());
Scott Izu
  • 2,229
  • 25
  • 12