Error Loading native 'JCudaDriver'

I’m trying to get to run the JCudaDriverTextureSample.java but get the exception below.

I’ve seen similar posts but I still can’t figure out my setup. I’m using Eclipse (still new to it), I set up a user libraries for jcuda and jogl/gluege-rt and placed the bucky.raw in the directory. I’ve used Cuda before (using 3.0), and i downloaded the Version 0.3.0a of Jcuda.

Thanks ahead for your help!

Error while loading native library with base name “JCudaDriver”
Operating system name: Windows XP
Architecture : x86
Architecture bit size: 32
Exception in thread “Thread-3” javax.media.opengl.GLException: java.lang.UnsatisfiedLinkError: Could not load native library
at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:410)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
at com.sun.opengl.util.Animator.display(Animator.java:144)
at com.sun.opengl.util.Animator$MainLoop.run(Animator.java:181)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:74)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:96)
at JCudaDriverTextureSample.init(JCudaDriverTextureSample.java:497)
at com.sun.opengl.impl.GLDrawableHelper.init(GLDrawableHelper.java:72)
at javax.media.opengl.GLCanvas$InitAction.run(GLCanvas.java:418)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:189)
at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:452)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: Could not initialize class jcuda.driver.JCudaDriver
at JCudaDriverTextureSample.initPBO(JCudaDriverTextureSample.java:661)
at JCudaDriverTextureSample.reshape(JCudaDriverTextureSample.java:862)
at com.sun.opengl.impl.GLDrawableHelper.reshape(GLDrawableHelper.java:85)
at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:431)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Exception in thread “AWT-EventQueue-0” java.lang.NoClassDefFoundError: Could not initialize class jcuda.driver.JCudaDriver
at JCudaDriverTextureSample.initPBO(JCudaDriverTextureSample.java:645)
at JCudaDriverTextureSample.reshape(JCudaDriverTextureSample.java:862)
at com.sun.opengl.impl.GLDrawableHelper.reshape(GLDrawableHelper.java:85)
at javax.media.opengl.GLCanvas$DisplayAction.run(GLCanvas.java:431)
at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:194)
at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
at sun.awt.RepaintArea.paintComponent(Unknown Source)
at sun.awt.RepaintArea.paint(Unknown Source)
at sun.awt.windows.WComponentPeer.handleEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

Hello

It’s strange that it also says
java.lang.NoClassDefFoundError: Could not initialize class jcuda.driver.JCudaDriver
since it seems to find the class later on.

Did you add the JCuda JAR files to the build path?
(Go to the Project Menu -> Properties -> Select “Java Build Path” in the Tree -> Select “Libraries” Tab -> Click “Add JARs…” and add the JCuda JARs there)

Where did you put the DLLs? If they are in the root directory of your project, it should find them.

bye

Heya,

I tried your suggestion but i received the same exception. I moved the dlls and jars into the root director, and used Add Jars from the Configure Build Path tab. I had created the libraries as a user library before btw. How do you hook in the jogl? I had created a user library for it. Is there a particular version of jogl that i need?

Thanks!

Hello

I assume that you installed the appropriate versions of the CUDA developer driver, the toolkit and the SDK. If they are all version 3.0, then JCuda 0.3.0a should work. (You might also consider updating to CUDA 3.1 and JCuda 0.3.1, although this should not have any influence on this problem, so you may want to try to find a solution for that first)

The version of JOGL that I used was this archive, although the latest version should be available on this site.

Usually, the error message
java.lang.UnsatisfiedLinkError: Could not load native library
indicates that it does not find the native DLL because it is not in a “visible” directory (that is, not in the project root or in a directory that is visible via the PATH environment variable). But as I mentioned, the first error message is
java.lang.NoClassDefFoundError: Could not initialize class jcuda.driver.JCudaDriver
which is unusual, and it might be that something wierd is happening there which afterwards causes the second error message.

Did you already try the other samples? You may try one of the Runtime samples first. These do not use JOGL, and may help to get the initial setup and the DLL locations right. If one of these samples works, the next step could be to see how to get the texture sample together with JOGL running.

bye
Marco

Howdy,

I have the cuda 3.0 SDK installed, and have successfully modified and run my own version of the nbody nvidia sample.
I’m using Eclipse Java EE IDE for Web Developers, Helios Release. I have used Eclipse successfully with another 3D package that uses the jogl, with no problems.

I’m using Java JRE “JavaSE-1.6”.

I downloaded the jogl 1.1.1 version and installed to the same directory. I’ve been playing with the build path, moving files, creating/deleting user libraries, but to no avail. I’ve used the user library setup before with no problems.

I tried the JCudaDriverCubinSample.java and got the exception (below). I checked the createLibname and it looks good. It seems that if the native dll is not found, the error message will state as such. But in this case, it seems like java JRE is have a difficult time find the JCudaDriver in the DLL.

I’m not sure what to do at this point, and I appreciate your help and quick response, but I think I’ll sit on this one for awhile, and probably install a new Java SDK, Eclipse (older), and CUDA SDK 3.1 sometime. This is a pretty awesome package and I will definitely would like to see it working.

Thanks!

JCudaDriverCubinSample.java exception:

Error while loading native library with base name “JCudaDriver”
Operating system name: Windows XP
Architecture : x86
Architecture bit size: 32
Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:74)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:96)
at JCudaDriverCubinSample.main(JCudaDriverCubinSample.java:30)

Hello

I have exported a minimal, basic project from Eclipse, containing the JAR and the Windows 32bit DLLs for JCuda 0.3.0a. You may download the archive from here:
http://www.jcuda.org/JCudaBasic_Export01.zip

In Eclipse, use
File -> Import -> General -> Existing Projects into Workspace -> (x) Select archive file -> Browse… And select the ZIP file -> Finish
This should create a project “JCudaBasic”, which only contains a small class that initializes the driver API and allocates and frees some memory.

Maybe this works as a first test?

bye
Marco

Hey Marco!

Thanks for the cuda sample, I tried it out and got the same exception :mad: (see below). I definitely need to try a different JRE and/or Eclipse. I don’t think its your code at all. Hopefully I will figure this one out and let you know in case someone has the same problem. Thanks again!

Error while loading native library with base name “JCudaDriver”
Operating system name: Windows XP
Architecture : x86
Architecture bit size: 32
Exception in thread “main” java.lang.UnsatisfiedLinkError: Could not load native library
at jcuda.LibUtils.loadLibrary(LibUtils.java:74)
at jcuda.driver.JCudaDriver.(JCudaDriver.java:96)
at JCudaDriverInit.main(JCudaDriverInit.java:13)

Hello,

Hm. Usually this error can be resolved with a proper setup and by placing the DLL in the right directory. At the moment I have ho idea what might be the problem there … that’s really strange.

Helpless guesses would be to re-install the JDK, and possibly the driver/toolkit/sdk, but I could not imagine where and how this should affect this error message. Sorry that I can not give any more specific help right now :confused:

bye