arindam
arindam

Reputation: 536

How to use winapi functions in java?

I am doing a project in java which has the function to add files in database, and i want to use winapi functions to select files. How would i do that?

Upvotes: 8

Views: 16568

Answers (3)

Mavrik
Mavrik

Reputation: 2630

By far the easiest way is by using Java JNA, it already has translation from stcalls in.

You can find a basic tutorial for it (with Winapi example no less) on JavaWorld.

You could also use JNI, but JNI requires you to use specially built header files for interfacing and it's all in all harder to maintain and use. It's slightly faster in some cases though.

Upvotes: 15

Deniz Acay
Deniz Acay

Reputation: 1719

I strongly advise JACOB (Java COM Bridge) for using COM interfaces. http://sourceforge.net/projects/jacob-project/

I wrote an app for getting song infos from Amazon Web Services. Its a nice library to have.

Upvotes: 0

user257111
user257111

Reputation:

You want Java Native Interface - this tutorial shows you how to implement your own but you could easily just point to WinAPI functions - http://java.sun.com/docs/books/jni/download/jni.pdf

Here's an example I found with a quick Google - not the neatest webpage but still demonstrates the concept well http://edn.embarcadero.com/article/20679

Upvotes: 1

Related Questions