开发者

Error running JCuda app in ubuntu

开发者 https://www.devze.com 2023-02-25 11:13 出处:网络
I\'m a new JCuda user and I started to try some samples in my node. I\'m running a simple: import jcuda.*;

I'm a new JCuda user and I started to try some samples in my node. I'm running a simple:

import jcuda.*;
import jcuda.runtime.*;
public class JCudaRuntimeTest{
     public static void main(String args[]){
         Pointer pointer = new Pointer();
         JCuda.cudaMalloc(pointer, 4);
         System.out.println("Pointer: "+pointer);
         JCuda.cudaFree(pointer);
     }
}

I put every library in the same folder and a can easily compile the code, but when I run java JCudaRuntimeTest, I got this exception.

Exception in thread "main" java.lang.NoClassDefFoundError: jcuda/Pointer
    at JCudaRuntimeTest.main(JCudaRuntimeTest.java:7)
Caused by: java.lang.ClassNotFoundException: jcuda.Pointer
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadCl开发者_开发知识库ass(ClassLoader.java:248)
    ... 1 more

suggestions?


NoClassDefFoundError almost always means that something is missing from your classpath.

Make sure the jcuda-<version>.jar file (as well as possibly other necessary JAR files) are on the classpath when you run your program.

You can specify the classpath when you run your program with the -cp switch, for example:

java -cp C:\Project\jcuda\jcuda-0.3.2a.jar;C:\Project\mystuff\classes org.mystuff.MyProgram

or by setting the CLASSPATH environment variable (not recommended).

0

精彩评论

暂无评论...
验证码 换一张
取 消