[kaffe] Re: [Java-gnome-developer] Java-Gnome: jni or cni

Elias Martenson elias-m at algonet.se
Thu Mar 11 14:50:17 PST 2004

tor 2004-03-11 klockan 18.44 skrev Mark Howard:
> Dear Java Developers,
> I am writing to you on behalf of the java-gnome project for advice
> regarding a major change we are currently considering. I apologise if
> this is off topic for this mailing list but we really need input and you
> are the most knowledgeable open source java developers; it may also
> help determine whether we will be using your projects in the future.
> Sorry for cross posting - we think members of each list are likely to
> have different opinions on this topic and want to hear them all.
> The big question is: should we switch to CNI?

I'm not a contributor (yet?), and I'm currently merely playing around
with Java-GNOME. However, I like it very much.

I am what could be considered an expert Java programmer. This is,
however, not the place to publish ones resumé. I do have 7 years of Java
development experience.

Reading peoples suggestions calling for CNI makes me very frightened.
I'll try to explain why:

In the current environment, Sun controls Java. I am not going to go into
whether this is good or not, but this is the way it is. Sun releases a
new version of java every 18 months or so, and every time they do there
are huge improvements. With 1.4 we got the IO channels, giving us
multiplexed IO and memory mapped files. 1.5 gives us the largest set of
improvements to Java we have ever seen, including generics, covariant
return types, shared VM's, etc... GCJ and CLASSPATH has to play the
catchup game all the time, and I don't think I can even use the 1.4 IO
channels in it yet.

Even if you don't use the new features yourself, what are you going to
do if your JDBC driver uses some new features? Don't forget that one of
the great strengths of Java is it's great open source community where
you can find pretty much every component you'd ever want freely
downloadable. Going CNI-only would severely limit the number of 3'rd
party component you'd be able to integrate.

The fact that Java is heavily dynamic (sandboxed execution, etc...) is
an enormous advantage, and I fail to see how an experienced Java
developer who uses these things could ever even consider turning the
back on everything that is Java, just to gain a little perceived

Speaking of performance advantage, has anyone even done any benchmarking
to decide how much of a performance difference we're talking about here?

Since Java is dynamic, I can, at runtime, detect whether Java-GNOME is
available, and select a Java-GNOME or a Swing-based user interface at
runtime. This makes it possible to ship an app that is both native
GNOME, and completely cross-platform (naturally, the practicality of
this depends heavily on the type of application). This app can still use
the same features available to all application running on the Java

Another thing: with Linux making more and more inroads into the
enterprise, things like JMX become increasingly important. How would you
go about hooking a GCJ-compiled application into a JMX container? My
guess it would be difficult at beast, if not completely impossible.
That's just one of many examples.

In summary, I don't think many of the pro-CNI people really use Java to
its fullest extent. I certainly want all the 1.5 features _and_
Java-GNOME. If Java-GNOME went CNI-only I myself would probably go back
to Swing.


Elias MÃ¥rtenson

More information about the kaffe mailing list