Fog Creek Software
Discussion Board

IBM listens Joel's complains about Java.

One of the complains about Java, that it does not use native controls ,
has been solved by IBM.

IBM offers a new graphical toolkit for Java, SWT, as part
of the Eclipse Project ( ) .  Not only truly
native platform widgets, but even OLE integration is included
in SWT.

See for a technical description.

At least it is posible to design applications in Java that are
just as usable as native ones.

Ramón García Fernández
Thursday, January 31, 2002

Borland did this before, as did Microsoft, although it was only for Windows. Sun tends to throw a hissy fit about "100% pure" blah blah when people do this.

Joel Spolsky
Friday, February 1, 2002

In the project I am currently working on I  do make JNI calls quite often. However, the use tends to only be needed once. So in this case I  do follow the technique mentioned in the article of  one to one mapping of native calls and keep the more complex logic in the java code.

However in a case where natives calls need to be made often I would think having an excessive number of calls into JNI reduce performance. Is this incorrect?

Damon Brantley
Sunday, February 3, 2002

There is a performance cost involved in making a JNI call. If performance is an issue, you're better off having fewer, coarser JNI calls, which may involve moving some application logic from Java into the native code to avoid additional round-trips.

"Optimize Later" is still the best rule. You don't know how much the native calls are going to slow your application. Ignore performance until you've got real profiling data. If profiling shows that the native calls are killing you, then refactor to reduce the number of native calls.

Charles Miller
Tuesday, February 5, 2002

*  Recent Topics

*  Fog Creek Home