• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to call .dll in java

 
narasimharao konjeti
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anand Sidharth
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 180
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic