Welcome to the Homepage of Senthil Nachimuthu
Java: org.eclipse.swt.SWTError: Not implemented [multiple displays] Print E-mail
User Rating: / 1
PoorBest 
Friday, 07 December 2007

I have a Java SWT program that runs beautifully on Windows (32 bit). It also ran fine on Linux 32 bit (x86). But when I ran it on a Linux 64-bit (x86_64) platform, I got this error:

Exception in thread "Thread-0" org.eclipse.swt.SWTError: Not implemented [multiple displays]

Read on for a workaround.

It seems that these errors are due to some thread concurrency or synchronization problems in the Java SWT library. This is the error message I got:

Exception in thread "Thread-0" org.eclipse.swt.SWTError: Not implemented [multiple displays]
    at org.eclipse.swt.SWT.error(SWT.java:3589)
    at org.eclipse.swt.widgets.Display.checkDisplay(Display.java:710)
    at org.eclipse.swt.widgets.Display.create(Display.java:823)
    at org.eclipse.swt.graphics.Device.<init>(Device.java:152)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:472)
    at org.eclipse.swt.widgets.Display.<init>(Display.java:463)
    at edu.ksu.cis.bnj.gui.GUIWindow.run(GUIWindow.java:672)
    at edu.ksu.cis.bnj.gui.GUIThread.run(GUIThread.java:68)

Here's the snipped of code from GUIThread.run:

public class GUIThread extends Thread{
    private GUIWindow _window;
    private BeliefNetwork _bn;
   
    public GUIThread(GUIWindow guiwindow, BeliefNetwork bn)
    {
        _window = guiwindow;
        _bn = bn;
    }
   
    public void run()
    {
        _window.run(_bn);
    }
}

 To fix this problem, I changed the run method to:

     public void run()
    {
        try {
            sleep(5000);
        } catch (InterruptedException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        _window.run(_bn);
    }

This took care of the problem. I tried sleep(1000) which didn't fix it. However, sleep(2000) fixed it. I made is 5000 just to be on the safe side. I'm not an expert of Java SWT thread synchronization, so I'll edit this if Sun fixes it or explains this issue in detail. 

 Thanks to the following poster for the tip:
 http://www.eclipsepowered.org/eclipse/forums/t97289.html





Digg!Reddit!Del.icio.us!Google!Live!Slashdot!Netscape!Technorati!StumbleUpon!Spurl!Newsvine!Furl!Blogmarks!Yahoo!Ma.gnolia!Free social bookmarking plugins and extensions for Joomla! websites!
 
< Prev   Next >
Creative Commons License Copyright 2004-2008 Senthil Nachimuthu. Some rights reserved. The original work on this website is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Powered by Joomla