Tutorial :Anyone here have any experience using gcj's CNI for java external libraries?


I've been interested in doing some work on a desktop application for while now and my most proficient language is Java. Due to wanting to be able to compile down to a native executable, does anyone have any experience they would like to share about using gcj to compile, and CNI for libraries? I was hoping to use of of the native toolkits, not just Swing/SWT.


As Eclipse has been sucessfully compiled natively (see http://www.linuxjournal.com/article/7413) I would say it's possible.

I used GCJ to embed Java code into an C++ application, but I would not use it for a UI application. I would go pure Java there (probably Eclipse RCP based) as that is where I have experience.

Have fun experimenting!


I haven't used gcj for compiling to a native executable but for interfacing to native libraries I've found JNA to be a very nice way to do it as you don't have to write any native code at all to make native calls. Note that doing it this way does result in a performance penalty so it probably wouldn't be an option if you're calling into native code in a tight loop where performance is likely to be an issue.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »