Two Laptop Bag*
The moose likes Java in General and the fly likes java - DLL communication Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "java - DLL communication" Watch "java - DLL communication" New topic
Author

java - DLL communication

vijay kumar
Ranch Hand

Joined: Nov 10, 2006
Posts: 62
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
Marshal

Joined: Mar 22, 2005
Posts: 41123
    
  45
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 ]

Ping & DNS - my free Android networking tools app
Timothy Wall
Greenhorn

Joined: Sep 14, 2002
Posts: 14
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

Joined: Aug 16, 2005
Posts: 14074
    
  16

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
jQuery in Action, 2nd edition
 
subject: java - DLL communication
 
Similar Threads
Calling a generic DLL
how to use DLL in java code
creating a dll out of a java class
how to run dll using java
Jni problem