Thursday, April 21, 2011

SWT applet: swt-win32-3650.dll already loaded in another classloader

I have multiple pages with java applet written with SWT. The problem is, applet loads only on first page, to load it on another page i need restart browser, otherwise i get following error:

Exception in thread "Thread-27" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons: 
    no swt-win32-3650 in java.library.path
    no swt-win32 in java.library.path
    Native Library C:\Documents and Settings\xxx\Local Settings\Temp\swtlib-32\swt-win32-3650.dll already loaded in another classloader
    C:\Documents and Settings\xxx\Local Settings\Temp\swtlib-32\swt-win32.dll: %1 is not a valid Win32 application

at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
at org.eclipse.swt.internal.C.<clinit>(Unknown Source)
at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)

I wonder, how can I unload swt dlls when browser page with applet is closed?

From stackoverflow
  • Applet class:

        @Override
        public void stop() {
            // do this to unload swt dlls
            System.exit(0);
        }
    
    Gili : This won't help if you load the same applet twice or other applications that use SWT simultaneously.
    kilonet : it actually a bad solution - has many side effects (for example it shutdowns all other loaded applets). But still something

0 comments:

Post a Comment