Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

accessing dlls using a jni in tomcat

Thread view: 
ian ward - 22 Jun 2005 16:25 GMT
Hello,
I have some dlls and a corresponding set of jni classes which are part
of my jar which I want to run as a web server in tomcat. I think that
the jar is in the right place (webapps\myapp\WEB-INF\lib) but I'm not
sure where I need to put the dlls. Up to now, while developing/testing
outside of tomcat I have put the jar and the dlls in the same folder
but that doesn't seem to do it. I may have to set some sort of system
variable like path (which I understand is the java.library.path under
windows (xp)). I have tried this but again no joy.

Strangely, I got the thing working for a while, don't know how (moving
files around etc), but that seems to have been a flash in the pan. I'm
trying to launch the jar from a jsp page, via a useBean action and I
get a 'page can't be displayed' message and tomcat crashes and I have
to restart so I don't get any help.

I'm starting to get to the hair-tearing stage so any help, pointers,
suggestions would be very welcome.
Thanks
Ian
Alan Krueger - 22 Jun 2005 17:21 GMT
> I have some dlls and a corresponding set of jni classes which are part
> of my jar which I want to run as a web server in tomcat. I think that
> the jar is in the right place (webapps\myapp\WEB-INF\lib) but I'm not
> sure where I need to put the dlls.

Just put them somewhere in the Windows PATH.  You'll need to reboot
Windows if you change the PATH environment variable and have Tomcat
launched as a service, since the Service Control Manager doesn't appear
to reload environment variables until it's restarted, which can't (IIRC)
be done without rebooting the entire operating system.

Also, you may want to put the JNI Java classes into Tomcat's common/lib
directory if you want to use these JNI classes in more than one web
application.  Otherwise, they might be loaded using separate class
loaders and any after the first load will fail.
ian ward - 22 Jun 2005 22:01 GMT
Thanks for the reply.

I have tried putting them in windows\system32 (but I suppose any folder
will do provided it's quoted in the path). This didn't seem to work but
I'll try again, I haven't always had 100% success with PATH.

So I don't need to worry about what the "working directory" is?

Haven't quite followed your reasoning on relaunching as a service etc.
Anyhow, if I can fix it, then restarting the OS is not very serious -
once it's fixed it's fixed, no?

For the JNI classes, I'm not intending to have them in common so I
suppose it doesn't really matter that I haven't understood your remark
about separate class loaders and failing loads!

Ian


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.