My first jcuda program

Please help me to find out the solution to this probem.

bibrak@bibrak-laptop:/media/Academics/Academic/Research/HPC/CUDA/JCUDA$ javac -cp .:$JCUDA_HOME/jcuda-0.2.3.jar:$JCUDA_HOME/jcublas-0.2.3.jar:$JCUDA_HOME/jcufft-0.2.3.jar:$JCUDA_HOME/jcudpp-0.2.3.jar


And when I run it, it runs and gets errorr …

bibrak@bibrak-laptop:/media/Academics/Academic/Research/HPC/CUDA/JCUDA$ java -cp .:$JCUDA_HOME/jcuda-0.2.3.jar:$JCUDA_HOME/jcublas-0.2.3.jar:$JCUDA_HOME/jcufft-0.2.3.jar:$JCUDA_HOME/jcudpp-0.2.3.jar JCudaRuntimeSample
Creating input data
Initializing device data using JCuda
Error while loading native library with base name “JCudaRuntime”
Operating system name: Linux
Architecture : i386
Architecture bit size: 32
Stack trace:
java.lang.UnsatisfiedLinkError: no JCudaRuntime-linux-x86 in java.library.path
at java.lang.ClassLoader.loadLibrary(
at java.lang.Runtime.loadLibrary0(
at java.lang.System.loadLibrary(
at jcuda.LibUtils.loadLibrary(
at jcuda.runtime.JCuda.assertInit(
at jcuda.runtime.JCuda.cudaMalloc(
at JCudaRuntimeSample.main(


I’m not a linux expert, but as far as I know you have to add the path which contains the native library to your LD_LIBRARY_PATH environment variable. According to the CUDA release notes you probably have to add the following lines to the file ~/.bash_profile from your home directory:


You may also want to look into the release notes at, where this is described for the CUDA libraries (search for "LD_LIBRARY_PATH in this document). I assume that the same has to be done for the path which contains the native JCuda libraries, so that they may be loaded dynamically from Java.


Great it works :slight_smile:

Great to hear that :slight_smile:

Alternatively, I think it should also work to add the libraries to the java.library.path, either via the command line or in your IDE.

I have also put this solution in the NVIDIA CUDA forums General CUDA GPU Computing Discussion