Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java - DLL communication

 
vijay kumar
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i want to call a DLL from my java code and need to pass some parameter to it.

can any one help me how to comunicate with DLL through java.

Thanks in advance

Regards,
Vijay.
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There would need to be some kind of JNI wrapper between the Java code and the DLL. Libraries like Jacob or JCom can remove much of the pain of creating these.
[ July 26, 2007: Message edited by: Ulf Dittmer ]
 
Timothy Wall
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by vijay kumar:
Hi,
i want to call a DLL from my java code and need to pass some parameter to it.

can any one help me how to comunicate with DLL through java.



JAWIN and JACOB provide good access to COM-based DLLs. JNA provides easy access to DLLs which export a standard C interface.
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15277
38
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JNI is the standard API to call native code, such as functions in a DLL. However, JNI can be hard to use and may require you to write some C or C++ code.

There are some libraries to make working with native code easier. Have a look at these ones:

NativeCall - Call native methods from Java without JNI
J/Invoke - The easy JNI replacement

These allow you to call native functions without having to write native wrapper functions yourself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic