jQuery in Action, 3rd edition
The moose likes Other JSE/JEE APIs and the fly likes Java GUI calling C++ dll and shared lib Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Other JSE/JEE APIs
Bookmark "Java GUI calling C++ dll and shared lib" Watch "Java GUI calling C++ dll and shared lib" New topic

Java GUI calling C++ dll and shared lib

Marcel Wentink
Ranch Hand

Joined: Sep 19, 2008
Posts: 157
What would be the best way to call a dll (on windows) or a shared library (on unix) from a java gui program.

We want to port a program which has calculation functions written in C++ and a small GUI in Delphi to other operating systems. One of the options would be, rewrite the GUI in Java, and let java call the native C++ code.

I was thinking of JNI, but I do not know if there are other options. I know that we also could use other tools like Qt, Mono and Lazarus, but that's not my task. I am investigating in Java is an options.

Thanks in advance for any advice.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20188

Since it's a library and not a whole program, JNI (or JNA which basically is JNI but then written in Java) is the only way I think.

Either that, or write the GUI in C(++). Qt can be used, but GTK+ (with gtkmm being the C++ version) is also quite good.

How To Ask Questions How To Answer Questions
I agree. Here's the link: http://aspose.com/file-tools
subject: Java GUI calling C++ dll and shared lib
It's not a secret anymore!