[jitsi-dev] libjitsi and JNA


#1

Hi,

I'm having trouble using JNA within libjitsi (modified source). I'm not fluent in Java so please bear with me (I'm sure this is a trivial question for most devs).

I added a custom class to make my internal speaker beep in Windows (InternalSpeaker.java below).

With the older non-libjitsi Jitsi source tree, I used to place my custom class within net\java\sip\communicator\impl\neomedia\notify and added com.sun.jna to net\java\sip\communicator\impl\neomedia\neomedia.manifest.mf. It compiled and ran fine.

Now I need to move my custom class to libjitsi so I placed it within org\jitsi\impl\neomedia\notify and made sure that in the root libjitsi source tree .classpath contains:
  <classpathentry kind="lib" path="lib/jna.jar"/>

Compilation/building of both libjitsi and jitsi is OK.

However, when I run Jitsi and try to make use of my custom class (make the internal speaker beep) I get the following error:

util.UtilActivator.uncaughtException().89 An uncaught exception occurred in thread=Thread[Thread-71,10,main] and message was: com/sun/jna/Library
java.lang.NoClassDefFoundError: com/sun/jna/Library
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
  at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1947)
  at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:752)
  at org.apache.felix.framework.ModuleImpl.access$400(ModuleImpl.java:72)
  at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1807)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
  at org.jitsi.impl.neomedia.notify.InternalSpeaker.ring(Unknown Source)
  at org.jitsi.impl.neomedia.notify.AudioSystemClipImpl.runInPlayThread(Unknown Source)
  at org.jitsi.impl.neomedia.notify.AudioSystemClipImpl.access$000(Unknown Source)
  at org.jitsi.impl.neomedia.notify.AudioSystemClipImpl$1.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.jna.Library not found by [116]

So I'm sure there's an easy fix but I'm not sure how Java wants it.
How do I make sure com/sun/jna/Library can be found at runtime?

Thanks,

Vieri


#2

Have you added the com.sun.jna package to the Import-Package list in Jitsi's src/net/java/sip/communicator/impl/libjitsi/libjitsi.manifest.mf?

···

On Jul 25, 2012, at 9:37 AM, Vieri wrote:

How do I make sure com/sun/jna/Library can be found at runtime?