How to use winapi functions in java?

前端 未结 3 2145
误落风尘
误落风尘 2020-12-09 13:32

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?

相关标签:
3条回答
  • 2020-12-09 14:00

    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

    0 讨论(0)
  • 2020-12-09 14:03

    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.

    0 讨论(0)
  • 2020-12-09 14:07

    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.

    0 讨论(0)
提交回复
热议问题