tags:

views:

356

answers:

3

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?

+1  A: 

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

Ninefingers
+5  A: 

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.

Mavrik
+1 first time I heard about JNA
stacker
A: 

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.

Deniz Acay