Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Also would like to finish HelloWorldSWT(Incorrect imports or library)
Also would like to finish HelloWorldSWT [message #811797] Fri, 02 March 2012 21:03 Go to next message
Fritz Schenk is currently offline Fritz SchenkFriend
Messages: 9
Registered: February 2012
Junior Member
I have am following the HelloWorldSWT Cheat Sheet.
WHen in step to Import the SWT project I choose org.eclipse.swt.gtk.linux.x86 which is the closes to what the Cheat Sheet states 'org.eclipse.swt.{platform}.{os}.{arch}.
When in step 'Write the Java code' I get type undefined for Display and Shell. To fix this I contigure the project properties "Java Build Path/Projects' tab and add the project org.eclipse.swt.gtk.linux.x86. and I also 'Organize Imports' which causes an import to be inserted in the source (import org.eclipse.swt.widgets.Display;).
I save and then attempt to run.
This fails with the following errors
<errors>
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-gtk-3738 in java.library.path
no swt-gtk in java.library.path
Can't load library: /home/intrader/.swt/lib/linux/x86/libswt-gtk-3738.so
Can't load library: /home/intrader/.swt/lib/linux/x86/libswt-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
at HelloWorldSWT.main(HelloWorldSWT.java:10)
</errors>

I have searched 'Forum Search' SWT and find an entry describing my problem by another member. However the solution suggested does not work.
I really like to complete the Cheat Sheet and would appreciate assistance.

Thanks
Re: Also would like to finish HelloWorldSWT [message #890280 is a reply to message #811797] Thu, 21 June 2012 17:55 Go to previous messageGo to next message
marta perez is currently offline marta perezFriend
Messages: 2
Registered: June 2012
Junior Member
Hello,

I have the same problem, this is the log I get:

!SESSION 2012-06-21 19:31:25.472 -----------------------------------------------
eclipse.buildId=I20110613-1736
java.version=1.7.0_05
java.vendor=Oracle Corporation
BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=es_ES
Command-line arguments: -os linux -ws gtk -arch x86_64

!ENTRY org.eclipse.osgi 4 0 2012-06-21 19:31:28.799
!MESSAGE Application error
!STACK 1
java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-gtk-3740 in java.library.path
no swt-gtk in java.library.path
Can't load library: /home/marta/.swt/lib/linux/x86_64/libswt-gtk-3740.so
Can't load library: /home/marta/.swt/lib/linux/x86_64/libswt-gtk.so

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:285)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:194)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:63)
at org.eclipse.swt.internal.Converter.wcsToMbcs(Converter.java:54)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:132)
at org.eclipse.ui.internal.Workbench.createDisplay(Workbench.java:695)
at org.eclipse.ui.PlatformUI.createDisplay(PlatformUI.java:161)
at org.eclipse.ui.internal.ide.application.IDEApplication.createDisplay(IDEApplication.java:153)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:95)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)




And I have installed the 64 bit java in the following path:

MARTA VirtualBox root @ :/ home / marta # update-alternatives - list java
/ usr/lib/jvm/java-7-oracle/jre/bin/java

Reading forums said no date had the JAVA_HOME variable, but if:

MARTA VirtualBox root @ :/ home / marta # echo $ JAVA_HOME/usr/lib/jvm/java-7-oracle


or was not installed the package:

MARTA VirtualBox root @ :/ home / marta # apt-get install libswt-gtk-3-jni libswt-3-gtk-java
Reading package lists ... done
Building dependency tree
Reading state information ... done
libswt-gtk-3-java is already the newest version.
libswt-gtk-3-jni is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Has anyone solved this problem for version 12.04 of 64-bit ubuntu

In advance thank you very much for the help.
Re: Also would like to finish HelloWorldSWT [message #890302 is a reply to message #890280] Thu, 21 June 2012 20:11 Go to previous message
Chance Solomon is currently offline Chance SolomonFriend
Messages: 1
Registered: June 2012
Junior Member
copy: files containing '3740' in /usr/lib/jni/libswt-*3740.so to ~/.swt/lib/linux/x86_64/

But, be sure the packages : libswt-gtk-3-java & libswt-gtk-3-jni are installed.

sudo apt-get install libswt-gtk-3-jni libswt-gtk-3-java

And

sudo cp /usr/lib/jni/libswt-*3740.so ~/.swt/lib/linux/x86_64/
Previous Topic:how to add ant script for bytecode instrumentation
Next Topic:Can't see custom warnings in eclipse
Goto Forum:
  


Current Time: Thu Apr 25 23:25:29 GMT 2024

Powered by FUDForum. Page generated in 0.03160 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top