wood burning stoves*
The moose likes Java in General and the fly likes how to call .dll in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to call .dll in java" Watch "how to call .dll in java" New topic
Author

how to call .dll in java

narasimharao konjeti
Ranch Hand

Joined: Apr 26, 2003
Posts: 130
hi, i have one .dll, i have execute the dll (bcos it will give some info) , the output should be stored in one file. and how to call .dll, and how to and stored in a file, using java.
waiting for reply.
cheers
nr konjeti


"Unwise to sweat petty stuff, wise to pet sweaty stuff."
Anand Sidharth
Ranch Hand

Joined: Dec 17, 2003
Posts: 44
Hi,
As far as i know dll can't be called inside a java code directly.
But u can call them using java native interface(JNI)
(write a c program to call the dll and use JNI for calling the program).
A bit of google search will show lots of examples available in the net.
Chris Stehno
Ranch Hand

Joined: Feb 26, 2001
Posts: 180
Basically you write a C wrapper around the DLL using a header file that javah will generate for you. Try this google search for more JNI info:
http://www.google.com/search?sourceid=navclient&ie=UTF-8&oe=UTF-8&q=java+%2Bjni
Warning, JNI is pretty advanced and does break the platform independance. You may want to make sure that there is no other way to do what you are trying to do.
Hope this helps.


- Chris Stehno, SCPJ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to call .dll in java
 
Similar Threads
using ocx in java (JNI)
How do call the function from .dll file in java
Native function calls...
call activex dll through javascript
calling ocx methods in C