tags:

views:

432

answers:

5

Recently I wrote an extremely basic Java Swing program with a couple of text fields and buttons. The program works fine for me on Ubuntu with Java 1.5. But when I try to run it on OSX (10.4), the main window is displayed correctly but the program seems unresponsive. Nothing seems to happen, no matter which button I click on.

I know next to nothing about Mac OSX, so is there something I might be doing wrong?

+2  A: 

Could it be that you are executing something off the Event-Dispatch Thread? For example, you might be creating, displaying and then modifying a JTextArea in the main thread.

oxbow_lakes
+2  A: 

Normally Java programs work fine in OS X - for example, Sound Bridge Commander is a java app that works fine on Mac and Linux. I would definitely make sure the Mac box is fully up to date, though. You mentioned that it's running Tiger, which means that it is several years old, the JVM it has may be incompatible with the one you compiled with.

Mike Heinz
A: 

Any chance you could put the code online somewhere so we could try it? I am actually using 10.4 as well so it would not be a problem.

willcodejavaforfood
+1  A: 

You may have SWT on the classpath. This sounds similar to a problem I had. If I remember correctly the mac SWT jar uses certain startup hooks to launch itself automatically. Then SWT interferes with Swing.

A: 

This could be that some of your code is compiled for Java 5 instead of Java 1.4, so whenever you try to invoke it an exception is thrown from the JVM you just cannot see?

Thorbjørn Ravn Andersen