Re: While calling c methods from servlets where should I place the .c and .dll in apache tomcat directory stucture?
Sunday, February 15, 2004 08:46 AM
Your .c and .h files are not necessary in a runtime environment. Your dll should go in the $TOMCAT_HOME/bin directory or anywhere that is accessible on the effective path when tomcat starts.
The class files with "native" declarations can go into your WEB-INF/classes directory but you will run into problems with servlet class reloading (JNI libraries can only be loaded once in a JVM). I would recommend putting the generated files into a jar and placing that in $TOMCAT_HOME/shared/lib. Jars in this directory exist in a class loader one step removed from all web app classloaders, and are available to all webapps. More importantly, they are only loaded once by tomcat. Make sure you have added a "static" declaration (or some other mechanism) to call System.loadLibrary("MyDllName_Without_The_Dll_Extension"); prior to making any calls on the classes with "native" methods.