The Design of Software (CLOSED)

A public forum for discussing the design of software, from the user interface to the code architecture. Now closed.

The "Design of Software" discussion group has been merged with the main Joel on Software discussion group.

The archives will remain online indefinitely.

Is java really cross-platform?

Are java GUI applications really cross-platform in terms of comunication with the clipboard, system wide keyboard bindings (copy/paste/new document...), native look and feel etc?
Sunday, May 06, 2007
I normally stick to Windows, but a couple of years ago I had to develop a Mac desktop application in Java.
Development was on the Pc in Windows and it worked without having to change anything for the Mac.
I think Bingo Card creator has a Mac and a Windows version.
Peter Muys Send private email
Sunday, May 06, 2007
It has been a while since I programmed in Java, but I have always had some problems running Java GUI (Swing) on Linux. In the past it was accented characters for my language, and for the past months it has been the mouse which somehow doesn't work very well on Swing's main menus.

It could be that I use the Xfce desktop and the problem has to do with its window manager or something. :-)

The funny thing is that I want to use NetBeans because it has better support for JavaScript and Ruby as of late, but I can't. :-) And not only that, because I could need to customize NetBeans even further to my needs... So far, I use my own semi-broken editor to create my programs, and it works great and I have it all customized...

That is, even though Java is supposed to be cross-platform and a good development platform, to me specifically it sucks big-time.
Joao Pedrosa
Sunday, May 06, 2007
Yes. We develop desktop applications that run on Windows and Linux. There are a few corner cases, especially in the gui area, but they are easy enough to work around.
Sunday, May 06, 2007
i guess you haven't heard the old saying, "write once, debug everywhere." oh man, that joke is soooooo 1999.
starving coder
Sunday, May 06, 2007
Lots of the things that make Java more complicated than seems necessary are there to facilitate device independence. I mean things like the layout managers, font factories, etc. I wrote a recreational app in Java and was surprised at the hardware and operating systems that seemed to support it without trouble.

There are probably three classes of features. First, there are ones that Java does not carry along, and therefore have to be present on the target machine, e.g. fonts. Also hardware features (how many pizels is that screen?). Second, there are features that vary from one enviroment to another, which are supported by Java. For these, you have to be sure that you are programming in the most general way and not using some shortcut for your own OS (e.g. the default on your OS may different from the default on the target OS). Third, there are features that are implemented by each OS for which Java is not responsible at all. I think cut/paste is in this category since you can think of it as a huge keyboard macro.
Peter Vanderwaart
Monday, May 07, 2007
I have written little Java apps, built them then run them on a different OS. It gets you a lot closer to cross-platform than some other solutions, I don't have a lot to say about that.

What does really bother me about Java is that it seems impossible to get a browser plugin from Sun for 64-bit computers. The mere idea that this should be a problem after years of 64-bit CPUs being sold boggles my mind.

My particular case is on a machine running Linux but from what I've read and seen of Windows XP x64, Windows machines have the same issue with Java in the browser.
Rob Send private email
Monday, May 07, 2007
Java and the clipboard, I can't respond to, as I've never used it or read about it.

In Swing: Keyboard bindings are a function of the "look and feel" used.  So, if you use one of the java native look and feels, yes, you identical keyboard bindings across all platforms.  But, if you use Java's approximation to the native platform's look and feel, then no, keyboard bindings are not consistent across platforms.  So, the short answer is, "it depends" on how you write your app.  And how you deploy it.

In Swing: Getting solid/good native look and feel in a java app is difficult, and requires either using an external package (e.g. for windows) or dealing with the vagaries of the native look and feel you're trying to emulate.  Karsten talks about this extensively on his site above and gives some very clear examples in that regard.  If it has to look and act native, java Swing is not necessarily a good choice.  QT, and SWT are other options exist that may be worth investigating depending on how much investment you have available to you.

If  "cross platform compatibility" means to have your GUI run exactly the same on Linux/MacOS/Windows then yes, that is possible with the java Swing look and feel mechanisms.

Google Web Toolkit is an option if you are willing to go the Ajax route.  There really are few applications that have to be thick client these days.

As always, it depends on the context.

John Hoffman Send private email
Monday, May 07, 2007
Yes.  Really.
Friday, May 11, 2007
Clipboard functionality is very platform-dependent, so if you want your Java word-processor to talk to the OS's clipboard, you're going to have to include some native code (DLL for Windows, .so for Linux.)  However, it's very easy to determine what OS you're on and load the appropriate binary.

Tuesday, May 15, 2007

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics
Powered by FogBugz