File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes How to wrap c \ c++ (DLL files) in a servlet or a java application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to wrap c \ c++ (DLL files) in a servlet or a java application" Watch "How to wrap c \ c++ (DLL files) in a servlet or a java application" New topic
Author

How to wrap c \ c++ (DLL files) in a servlet or a java application

Howard Zhao
Greenhorn

Joined: May 06, 2002
Posts: 27
Dear All
I am working on developping new web side applications (servlets). I was given some c\ c++ code which was used to generate DLL files as CGI to access back end database. Since the code was well developped and tested, I do not want to touch them at all. How can I write a "wrapper" so that I can use the code or DLL files in my servlets? I mean could I write a java based servlet / application to call these c \ c++ fuctions or use these DLL files?
Thanks a lot.
Have a nice nice holiday.
Howard
Balaji Loganathan
author and deputy
Bartender

Joined: Jul 13, 2001
Posts: 3150
Hi,
I heared that a VB/VC++/ASP can call a java objects via com & JNI or something.
Example: A asp.net can call apache Fop and do the rendering.
I don't the reverse.Just have a look at some JNI documentation,may be it will help you.
Regards


Spritle Software Blogs
Rene Larsen
Ranch Hand

Joined: Oct 12, 2001
Posts: 1179

You can use this:

The dll/so e.g. for Win32 'dll_java.dll' or UNIX 'dll_java.so' should be placed in LD_LIBRARY_PATH (Unix) or PATH (Win32)
/Rene


Regards, Rene Larsen
Dropbox Invite
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12761
    
    5
One alternative would be to run this C++ code as an application communicating with servlets via sockets. If the data that is passed for CGI access is something simple like a String, this works pretty well. Of course you would have to write some C code to handle the socket communication. One advantage - you can test it outside the servlet environment first.
You would have to watch out for multi-threading issues of course with JNI or any other approach.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to wrap c \ c++ (DLL files) in a servlet or a java application
 
Similar Threads
using ocx in java (JNI)
calling ocx methods in C
Java and C# in 1 project
How do I create a COM+ object with Java?
Calling VB Dll In JAVA