Launching Kernel from a JAR file?

I was wondering, how do you guys call a PTX file when from a java JAR file? Right now, say I have a directory structure such as, …/RUN_FILTER/run_jcuda_filter. This is the java file that is launching the kernel. I put the compiled kernel ptx file into the same /RUN_FILTER/ directory and jarred the whole thing but when I run it, I get an error saying the file is not found. I was wondering a way around that?

-Thank you,


Some more information about your setup might be helpful. Note that, when you want to access a resource from a JAR, you can not use a ‘File’ or ‘FileInputStream’. Instead, you have to obtain the data with getClass().getResourceAsStream(…), and read the whole InputStream into a byte[] array in order to pass it to the CUDA method. You might want to have a look at the “KernelLauncher” class from the Utilities package ( ) which allows loading a PTX from an InputStream for exactly that purpose.