Welcome!

Java Authors: Maureen O'Gara, Liz McMillan, Walter H. Pinson, III, Yakov Werde, Tony Bishop

Related Topics: Java

Java: Article

A JNI-Bridged Java Desktop Application

Native Performance and Java Control - Bridging Domain Gaps

Another painful experience is debugging in JNI.

I found ETNUS, a JNI IDE where you can debug Java code and native code in the same environment, but it will cost you some extra bucks. However, the context switching between Visual Studio and Eclipse can be really painful. We explored some hardcore turnarounds like using the "_asm int 3" interruption call on Visual Studio so that we could force an interruption call but that's not elegant.

Conclusion
At this point I hope I've convinced you folks that JNI is definitely the right choice for native code access from a Java desktop application in the scenarios involving, say, graphics and numerics in general. CORBA causes headaches, for example, not being able to bind to the ORB because of a local host Naming Service misconfiguration.

JNI overcomes limitations in Java solutions, especially performance.

Another insight we've had is that accessing a native application through some inter-process technology doesn't benefit much from knowing other designs. In JNI this is a tighter conversation.

Legacy code should be well designed for access through JNI.

If your legacy code isn't modularized, it will very hard to access cleanly from Java or from other languages. The solution proposed in the JVipe scenario was only possible due to the well-designed event-oriented native layer.

So I take the current number of solutions coming out as motivation as industry jumps on JNI support. Let's hope for more JNI support from IDE vendors.

References

More Stories By Mario de Sa Vera

Mário de Sá Vera is a software architect and works as an IT consultant in Brazil.

Comments (4) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Chris Gottbrath 08/09/06 07:30:09 PM EDT

Mario -- great article.

Just wanted to point out that the product from Etnus, mentioned in the article is a C/C++/Fortran debugger called TotalView, not a Java IDE. It is designed to be used in conjunction with any IDE (or even by programmers who prefer editor and command lines). As Mario points out it can be used to debug the C++ side of JNI applications.

Check it out.

JDJ News Desk 08/01/06 06:31:20 PM EDT

I'm going to share my experience of enabling a graphics-oriented GIS visualization module with a C++ rendering engine for a Java desktop application using JNI technology. The solution was implemented in the GIS library TerraLib as part of the TerraLib Develoment Toolkit (Tdk), applying a JNI-bridged drawing canvas as part of the Components API used by the rendering engine.

JDJ News Desk 08/01/06 06:31:19 PM EDT

I'm going to share my experience of enabling a graphics-oriented GIS visualization module with a C++ rendering engine for a Java desktop application using JNI technology. The solution was implemented in the GIS library TerraLib as part of the TerraLib Develoment Toolkit (Tdk), applying a JNI-bridged drawing canvas as part of the Components API used by the rendering engine.

JDJ News Desk 08/01/06 05:35:32 PM EDT

I'm going to share my experience of enabling a graphics-oriented GIS visualization module with a C++ rendering engine for a Java desktop application using JNI technology. The solution was implemented in the GIS library TerraLib as part of the TerraLib Develoment Toolkit (Tdk), applying a JNI-bridged drawing canvas as part of the Components API used by the rendering engine.