Log in

No account? Create an account
Why Java Sucks for Cross-Platform GUI - Shlomif's Technical Posts Community [entries|archive|friends|userinfo]
Shlomif's Technical Posts Community

[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

[Links:| Shlomi Fish's Homepage Main Journal Homesite Blog Planet Linux-IL Amir Aharoni in Unicode open dot dot dot ]

Why Java Sucks for Cross-Platform GUI [Oct. 20th, 2012|12:49 pm]
Shlomif's Technical Posts Community


[Tags|, ]
[Current Location |Home]
[Current Mood |happyhappy]
[Current Music |The Wallflowers - One Headlight]

When the Java programming language first became publicised, it was heralded as the dawn of a new age of writing cross-platform programs. “Write once, run everywhere” they said. Now, 16 years after 1996, which was roughly when the Java hype started, I’d like to check if it delivered on this promise, by seeing if one can easily write a cross-platform GUI (= Graphical User-Interace) application using it. What I’m looking for is a Java GUI library that: 1. Compiles. 2. Is cross-platform. 3. Does not suck. Teaser: I was not able to find one.

The standard Java SWING toolkitis out-of-the-question due to its weird look and feel and crappy behaviour everywhere. Joel on Software has this to say about SWING:

If you still think that something as small as how long you hold down the Alt key when you activate a menu command doesn't matter, well, your software is going to make people unhappy. These tiny inconsistencies are what makes Swing applications so unbearably annoying to use, and in my opinion it's why there are virtually no commercially successful Java GUI applications.

(From the book reviews, there's more criticism of it in “Lord Palmerston on Programming”.)

I too have been frustrated by the unusable Java SWING GUIs, and in one of the latest projects I am contributing to, which has already been written in Java, I ran into a particularly buggy SWING UI.

The Eclipse people implemented something called SWT, but according to the wikipedia, it has several limitations, and require writing a lot of platform-dependent code.

Next are the Qt bindings to Java - Qt Jambi. These require customising the build.properties (whereas the error and documentation says one should edit the buildpath.properties file), and after that fails compiling with this error:

[make] ../../generator/out/cpp/com_trolltech_qt_core/
qtjambishell_QFutureIterator.cpp:21:15: error: no matching
function for call to ‘QFutureIterator::QFutureIterator()’

Next I looked into java-gnome, but apparently it does not work on Windows, so it's not cross-platform.

And the Java bindings for wxWidgets offer wxJava, which is Windows-only and unmaintained, and wx4j and jwx!, which are unmaintained and no longer build.

So I think that leaves us with nothing. How sad. Compare that to the comprehensive coverage of Mono’s GUI toolkits, many of which are cross-platform, and to the situation in other languages such as Perl or Python, and you'll see that Java sucks the most in this respect.


From: (Anonymous)
2012-10-20 05:25 pm (UTC)
See, I actually see Java/Swing as the most cross platform toolkit around. It even runs fairly well on OpenVMS. It is not hard to setup "native look-and-feel" that looks fairly well.

Now you provide as an example Mono toolkits... GTK mono (the "best" one) does not really have native look and feel outside Linux (and Windows GTK look sucks) and documentation lacks...

Every other language requires numerous 3rd part libraries etc.

Python - the "native" gui Tk does not even support RTL?

Actually seeing some big projects using Swing I think it is fine platform. I'd say the best to make really cross platform stuff.
(Reply) (Thread)
[User Picture]From: shlomif
2012-10-20 05:50 pm (UTC)

Read what I said.

The problem with Java SWING is that it always feels wrong and out-of-place. It does not look native and act native. With the Nurikabe Maker project, I also ran into many incredibly horrid and critical behaviour bugs which we don't know where they stem from or what to do about them.

Gtk+ in Mono, and in other places, can be made to look better using Themes, and it's not the only toolkit available for Mono (don't know why you think it's the "best" one).

The fact that every other language requires 3rd party libraries should not matter a lot if you have decent packaging. See “But I can't use CPAN” for silliness like that.

There are other GUIs available for Python aside from Tk and Tkinter, but they don't work properly with Java.

So I would say still Java/SWING is the worst choice all around and Java is bad. For the Nurikabe garden project, I am going to try to use Perl's Inline::Java and write an alternative GUI using Perl/Qt or something.

Finally, Artyom, I should note that you have made numerous spelling, grammar and punctuation errors in your post (and in previous posts). You really should improve your English writing, because otherwise people won't take you seriously.

(Reply) (Parent) (Thread)
From: (Anonymous)
2012-10-21 07:48 am (UTC)

Re: Read what I said.

If "out-of-place" look and feel worries you. you might find SWT a bit more friendly.
(Reply) (Parent) (Thread)
[User Picture]From: shlomif
2012-10-21 09:56 am (UTC)

Re: Read what I said.

I covered SWT in my overview, and the wikipedia page (to which you give a link-less URL) mentions several major reasons why it is not too good.

(Reply) (Parent) (Thread)
From: (Anonymous)
2012-10-20 05:26 pm (UTC)
BTW the commend above was mine (Artyom)
(Reply) (Thread)
[User Picture]From: shlomif
2012-10-20 05:42 pm (UTC)

Artyom, who?|

Artyom, who?

(Reply) (Parent) (Thread)