This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes question about Servlets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "question about Servlets" Watch "question about Servlets" New topic
Author

question about Servlets

Salman Faraz
Greenhorn

Joined: Feb 14, 2005
Posts: 28
Respected Group Members,
I have written a function in C language and now I want to call it from my Servlet application,is it possible to call functions written in other languages from Servlets,do we have to use JNI for this purpose and can JNI be used with Servlets,how can we use JNI with servlets and what API will I need to start working on JNI.

Thanking You,
Salman Faraz.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

You have to use JNI, unless you can warp your function in a webservice, CORBA IDL, or some other remote invokation approach. There is no problem calling native function from servlet. I'd recomend to put dll in bin directory inside war, then use getRealPath() of servlet context to specify path to dll in load function. You may want to check security settings, because some servlet container could not allow you to load dlls.


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: question about Servlets