Thursday, April 07, 2005

Java on the desktop.

I posted the following a few weeks ago on the Jive forums. I didn't get a reply, so thought I'd resurect it here.

Native integration issues are killing Java on the Desktop. There needs to be a much better solution than JNI -- many Java developers today (and more tomorrow) don't know how to write in C, never mind compile / link / port across Win/Linux etc. For those who have been there, we don't want to go back.

I think the Unsafe class or equiv could be expanded to give real native style access -- it doesn't need to be a security issue either, just make it the equivalent of JNI from a security point of view.

By changing a single registry entry, I can take any C# class and then simply invoke the methods from inside Excel. Why can't I do this in Java? I realise there are threading / reference issues with some calls but these are all solvable. If the basic ability to make any native invocation is there, frameworks that deal with the differences in threading models etc can be built (outside the JDK imho, open source most likely, maybe on The latter will need to evolve, but there should be a way to invoke any library function.

I want to take any DLL/lib and call into / regsiter callbacks from Java. No C code involved. The JDK might provide a command to generate a Java typelib.jar or something that does the low level mapping but no C code please.

If Java was painless as a web services client stack on the desktop for Excel to call, most projects I've seen in the last 2 years (finance industry) would drop .NET development for pure simplicity reasons.

I want integration as good as Eclipse gives, if not better -- eg most trading apps would love to embedd an excel sheet in a swing gui but don't for fear of the complexity / pain involved. (Excel has other issues but let's not go there).

There's been a Java-COM bridge for ages - not really supported as far as I know though. Why not?
It's an opinion I made to John Rose (Hotspot, Groovy) at GroovyOne last year. There's a clear bias due to my job mostly being in large banks, but I think the points are fairly general. I hope Mustang or it not, Dolphin, make some significant in-roads to Java on MS desktops. Perhaps, taking the series of arcticles here or folding JDIC into the JDK is needed. It would be a start; it is needed.

Well, i do not think Sun should provide much of the JNI related libraries. It is already not easy to provide platform independency of current JAva. There are several Com bridges available. The best i have seen is JNIWrapper, they have excellent JNI products, including Com bridge. Registry or Dll access is very easy too. It is a commercial product, but cheap and royalty free. 2 or three open source altenatives exists too (For Com, check Jawin)
I agree with the blogger on this one. If I so choose, let me easily call into platform native libraries. I really don't want to write C code just to call a .dll or COM method. Yes, it will tie me to a particular platform, but I'm willing to deal with that in other ways. In my opinion, it would be easier in Java than C anyway. Just create an interface that encapsulates the specific functionality and create various implementations for different platforms, then, at run time, depending on what platform you are running, dynamically instantiate a particular implementation. Let me avoid C altogether and do it entirely in Java.
Post a Comment

Links to this post:

Create a Link

<< Home

This page is powered by Blogger. Isn't yours?