Cross-platform desktop Java applications, JavaFX is not enough

Posted by Marco Dinacci on 0 comments

I just finished to watch the JavaOne 2012 Technical Keynote. Nice, not particularly impressive though. The "Windows moment" (JVM crash) was quite funny. It happens around the 52nd minute I think. No you can't skip and if you advance too much the video won't play. Flash fails.

What bothers me and the motivation why I'm writing this post is the excessive focus on the UI in JavaFX. They made it look like it is the only concern in a multi-platform app is the UI. WRONG.

The UI is only half of the problem. The other half, which becomes more and more complicated thanks to the advent of app stores and sandboxes is the integration with the host OS.

Where do you store application settings and data on Windows, Linux and OSX ?

The era of storing data in the application bundle itself or in ~/.appname or anywhere you want IS OFFICIALLY OVER.

Apple doesn't allow a sandboxed application to mess with the filesystem. Windows 8 won't either. You want to store settings ? put them in Application Support directory. Want to save documents ? do it in the Documents folder.

There's more, the problem is not only related to writing data. The OSX and Windows 8 sandboxes only allow you full access in the container (AppData on Windows 8) folder. Want to read the pictures folder ? you need to ask the OS where it is and have an entitlement (capability on Windows) declared in the Info.plist (Manifest file on Windows).

How is a Java application supposed to deal with this in a clean, cross-platform manner ?

Well you can't now, "write once run anywhere"...

They didn't show the dreaded GateKeeper warning dialog you get when you launch an application coming from an unidentified developer when they demoed their app on OSX. Why ? Because it wasn't sandboxed.

Moneydance is the first OpenJDK, sandbox-compatible app available in the Mac App Store. It took us months to make it ready. I contributed at least four patches to the OpenJDK OSX port, I had to fork and improve AppBundler because Oracle doesn't accept contributions on this Open Source project (unless it's one line of code...), and write native code where no other Java-only solution existed.
This whole process was much more time consuming that tuning the interface to be more OSX-like.

Fancy graphics and animations are pointless if an application can't be executed at all.

Oracle must improve the Desktop API and start eating its own dog food. Release complex software on the Apple App Store and start working towards a solution for the Windows 8 store, where the situation is even grimmer. If Oracle itself doesn't show that it's possible to deploy a Java app on the app stores who will ? We did our part with Moneydance, but it's not enough.

App stores, whether that's good or bad, are becoming the most accepted and simple way to buy software. What is the point of a cross-platform JavaFX app if you can't deploy it ?

I'm planning to start an Open Source project in the next few weeks to attempts to solve the problem of accessing user directories consistently over multiple platforms. I'll post more info once I'll have a foundation ready.