Re: How can I modify the java.library.path in Tomcat?
Andi Heusser wrote: I have a web application where I need to load some 3rd party libraries DLLs) and I would like to have these DLLs in a subdirectory in my app (webapps/MyApp/WEB-INF/lib). However when I try to do a 'loadLibrary' it fails to find them. I then noticed that the 'Tomcat/bin' directory is in this path and if I copy the DLLs in there, then it works fine. I've tried to set the system property inside my app in the static initializer of the main class but that doesn't seem to work. I basically tried to do the following: static{ String libPath = System.getProperty(java.library.path); String myLibPath = System.getProperty(myapp.lib.path); //env var set in PC's system variables (WinXP) System.setProperty(java.library.path, libPath + File.pathSeparator + myLibPath); } This is not Tomcat specific. java.library.path is readonly, so this won't work. You'll have to set the property on startup of the JVM, i. e. add -Djava.library.path=your path to the JVM's arguments. I also looked through the Tomcat conf files but I couldn't find any place where I could properly set or override the java.library.path. Is there a way to set this in Tomcat or will I have to copy the DLLs into Tomcat's bin directory? If you start Tomcat with the shell scripts, you can create a file named setenv.sh (resp. setenv.bat on Windows) where JAVA_OPTS is set appropriately. If you use the service launcher, you'll have to define this somewhere in the GUI. Regards mks - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
How can I modify the java.library.path in Tomcat?
Hi, I have a web application where I need to load some 3rd party libraries DLLs) and I would like to have these DLLs in a subdirectory in my app (webapps/MyApp/WEB-INF/lib). However when I try to do a 'loadLibrary' it fails to find them. I then noticed that the 'Tomcat/bin' directory is in this path and if I copy the DLLs in there, then it works fine. I've tried to set the system property inside my app in the static initializer of the main class but that doesn't seem to work. I basically tried to do the following: static{ String libPath = System.getProperty(java.library.path); String myLibPath = System.getProperty(myapp.lib.path); //env var set in PC's system variables (WinXP) System.setProperty(java.library.path, libPath + File.pathSeparator + myLibPath); } I also looked through the Tomcat conf files but I couldn't find any place where I could properly set or override the java.library.path. Is there a way to set this in Tomcat or will I have to copy the DLLs into Tomcat's bin directory? Thanks. Regards, Andi
Re: How can I modify the java.library.path in Tomcat?
--- Andi Heusser [EMAIL PROTECTED] wrote: Hi, I have a web application where I need to load some 3rd party libraries DLLs) and I would like to have these DLLs in a subdirectory in my app (webapps/MyApp/WEB-INF/lib). However when I try to do a 'loadLibrary' it fails to find them. I then noticed that the 'Tomcat/bin' directory is in this path and if I copy the DLLs in there, then it works fine. I've tried to set the system property inside my app in the static initializer of the main class but that doesn't seem to work. I basically tried to do the following: static{ String libPath = System.getProperty(java.library.path); String myLibPath = System.getProperty(myapp.lib.path); //env var set in PC's system variables (WinXP) System.setProperty(java.library.path, libPath + File.pathSeparator + myLibPath); } I also looked through the Tomcat conf files but I couldn't find any place where I could properly set or override the java.library.path. Is there a way to set this in Tomcat or will I have to copy the DLLs into Tomcat's bin directory? Thanks. Regards, Andi I like finer control over loading native files. I use System.load instead. You can get your web app path from the Servlet API. It makes it easier and you don't have to make sure your library is on a path. Wade - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]