Skip to Main Content

Java HotSpot Virtual Machine

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

including jar files in the classpath for JNI

843829Apr 3 2006 — edited Apr 18 2006
Hi I am having a bit of trouble setting the correct classpath for jar files in JNI.

I have a standalone Java class
myClass
which uses a jar file
mjar.jar
. This class can be used from a main "mainClass fine.
myClass
builds fine

I make and build the
mainClass
using a batch file.
SET ROOT_DIR=D:\myDocs
SET CP=.
SET CP=%CP%;%ROOT_DIR%\myjar.jar
javac -g -classpath %CP% mainClass.java

SET ROOT_DIR=D:\myDocs
SET CP=.
SET CP=%CP%;%ROOT_DIR%\myjar.jar
java -classpath %CP% mainClass
All that works fine.

However when I reuse myClass in a JNI c file, the JNI cant find the class. There is not a problem with the origional JNI code as If I remove the jar stuff in
myCLass
, the JNI code finds the myClass and workes fine.

So the problem is that I am unsure how to set the class path for JNI code in C to find/include the Jar files
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 16 2006
Added on Apr 3 2006
4 comments
608 views