Two Laptop Bag*
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 Murach's Java Servlets and JSP this week in the Servlets 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
Author

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
Sheriff

Joined: Oct 27, 2005
Posts: 19649
    
  18

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.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
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
 
Similar Threads
JNI in solaris (urgent)
creating a dll out of a java class
creating dll
Get Serial number of exernal hard disk/Thumbdrive using java code &work for both linux and windows
Calling a DLL from Java