0

I have a java application in netbeans, it will build and run from the command prompt in windows 7, then when I send the .jar to my windows XP virtual machine I get a exception when I try to run it.

Exception in thread main, java.lang.NoClassDefFoundError: org/jnativehook/mouse/NativeMouseInputListener

I figure this exception means that my library JNativeHook is not being built with my .jar, but I know it is because it runs on my windows 7.

Any ideas?

  • Normally, when you build a project, dependent libraries need to be included as part of the deployment. Depending on how you've built it, these "additional" libraries may be defined as part of the Jars class path from within the manifest file – MadProgrammer Aug 15 '13 at 05:58
  • You need to copy over any needed DLL's too – Thorbjørn Ravn Andersen Aug 15 '13 at 06:05

1 Answers1

0

As NativeMouseInputListener is a native class, so the path of the containing library on windows xp may be different from windows 7.

Juned Ahsan
  • 67,789
  • 12
  • 98
  • 136
  • Could you expand on your answer, what do you mean a native class? And shouldn't the library file be compiled into the .jar? –  Aug 15 '13 at 05:58
  • @BumSkeeter Why? Did you tell it to? – MadProgrammer Aug 15 '13 at 05:59
  • @BumSkeeter I am not sure of a way to convert a native library to a jar. I am not an expert but converting a native code written in c/c++ to java can be a tedious. That is why we use JNI to access native code. – Juned Ahsan Aug 15 '13 at 06:01
  • How do I define the path in the .jar where it looks for the library? –  Aug 15 '13 at 06:07
  • @BumSkeeter I believe this is how you must be giving the path -Djava.library.path="C:/MyLibPath;%PATH%" – Juned Ahsan Aug 15 '13 at 06:10
  • 2
    @BumSkeeter For netbeans follow this post: http://stackoverflow.com/questions/12798530/including-native-library-in-netbeans – Juned Ahsan Aug 15 '13 at 06:11