Skip to main content

Cannot run/debug Swing app under Eclipse on Mac OS X

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
2 replies [Last post]
trojanfoe
Offline
Joined: 2005-02-04

I am unable to run or debug a Swing application under eclipse under Mac OS X. The application starts, creates the main window and generates the following errors to the console and then stops (and needs stopping from within eclipse).
Error messages:
2011-02-04 20:45:18.425 java[3934:903] [Java CocoaComponent compatibility mode]: Enabled

2011-02-04 20:45:18.427 java[3934:903] [Java CocoaComponent compatibility mode]: Setting timeout for SWT to 0.100000
2011-02-04 20:45:19.190 java[3934:903] *** __NSAutoreleaseNoPool(): Object 0x1006262c0 of class __NSCFDate autoreleased with no pool in place - just leaking
If I run the application from the command prompt, however, it appears to run correctly.
From searching other forums etc it seems that the JVM flag -XStartOnFirstThread is the problem and needs to be removed form the application launcher. Can anyone comment on what the problem is here?
The application code is below:
package packagename;

import java.awt.EventQueue;
import javax.swing.JFrame;

public class SomeApp
{

private JFrame frame;

/**
* Launch the application.
*/
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()
{
try
{
SomeApp window = new SomeApp();
window.frame.setVisible(true);
}
catch (Exception e)
{
e.printStackTrace();
}
}
});
}

/**
* Create the application.
*/
public SomeApp()
{
initialize();
}

/**
* Initialize the contents of the frame.
*/
private void initialize()
{
frame = new JFrame();
frame.setBounds(100, 100, 450, 300);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
anthony_p
Offline
Joined: 2006-07-24

There's mostly Oracle Java (i.e. Windows and Linux/Solaris) experts present on this forum at this time.
I suggest to ask this question on Apple Java forums instead.

trojanfoe
Offline
Joined: 2005-02-04

It's solved now - it was just a case of removing swt.jar from the project dependencies.