Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 325314 - no SWT Widget display in linux - java.lang.UnsatisfiedLinkError: Could not load SWT library.
Summary: no SWT Widget display in linux - java.lang.UnsatisfiedLinkError: Could not lo...
Status: CLOSED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-09-15 03:46 EDT by amos CLA
Modified: 2016-12-20 15:41 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description amos CLA 2010-09-15 03:46:09 EDT
Build Identifier: 

1 I wrote a demo to put a swt into canvas. In windows ,it is OK and could show two buttons.
import org.eclipse.swt.*; 
import org.eclipse.swt.awt.*; 
import org.eclipse.swt.layout.*; 
import org.eclipse.swt.widgets.*; 

public class SWTInAWT { 
public static void main(String[] args) { 
        java.awt.Frame frame = new java.awt.Frame("AWT Frame"); 
        java.awt.Button button = new java.awt.Button("AWT Button"); 
        frame.add(button, java.awt.BorderLayout.NORTH); 
        java.awt.Canvas canvas = new java.awt.Canvas(); 
        frame.add(canvas, java.awt.BorderLayout.CENTER); 

        frame.addNotify(); 
        
        Display display = new Display(); 
        Shell shell = SWT_AWT.new_Shell(display, canvas); 
        shell.setLayout(new FillLayout()); 
        Button swtButton = new Button(shell, SWT.PUSH); 
        swtButton.setText("SWT Button"); 
        frame.setBounds(20, 20, 300, 300); 
        
        shell.layout(); 
        frame.setVisible(true); 
        
        while (!shell.isDisposed()) { 
                if (!display.readAndDispatch()) display.sleep(); 
        } 
        display.dispose();
} 
} 

2 when I run it in linux Redhat 5 EL, it will throwException.

[root@vms74 test]# java -cp swt-3.6-gtk-linux-x86.jar:/home/shan/test -Djava.library.path=/home/shan/test SWTInAWT
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
        no swt-pi-gtk-3650 in java.library.path
        no swt-pi-gtk in java.library.path
        /tmp/swtlib-32/libswt-pi-gtk-3650.so: /tmp/swtlib-32/libswt-pi-gtk-3650.so: undefined symbol: gtk_window_is_active
        Can't load library: /tmp/swtlib-32/libswt-pi-gtk.so

        at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
        at org.eclipse.swt.internal.Library.loadLibrary(Unknown Source)
        at org.eclipse.swt.internal.gtk.OS.<clinit>(Unknown Source)
        at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
        at org.eclipse.swt.internal.Converter.wcsToMbcs(Unknown Source)
        at org.eclipse.swt.widgets.Display.<clinit>(Unknown Source)
        at SWTInAWT.main(SWTInAWT.java:16)

3 I put the *.so in swt-3.6-gtk-linux-x86.jar into this directory. It also can not run. 

Reproducible: Always
Comment 1 Felipe Heidrich CLA 2010-09-15 09:17:24 EDT
What build ?
Please download and test using SWT 3.7 M1
http://download.eclipse.org/eclipse/downloads/drops/S-3.7M1-201008051700/index.php#swt