Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » SWT Tutorial fails at RunAs (Could not load SWT library)(fails to load some swt*dlls from eclipse installation)
SWT Tutorial fails at RunAs (Could not load SWT library) [message #995532] Sun, 30 December 2012 11:28 Go to next message
mario semo is currently offline mario semoFriend
Messages: 2
Registered: December 2012
Junior Member
Hello,

i've installed eclipse-rcp-juno-SR1-win32.zip and performed the Console Hello World and 90% of the SWT Hello World. The HelloWorldSWT compiles fine, but running the app results in:

SWT Sample

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-win32-4234 in java.library.path
no swt-win32 in java.library.path
Can't load library: C:\Dokumente und Einstellungen\ms\.swt\lib\win32\x86\swt-win32-4234.dll
Can't load library: C:\Dokumente und Einstellungen\ms\.swt\lib\win32\x86\swt-win32.dll

at org.eclipse.swt.internal.Library.loadLibrary(Library.java:331)
at org.eclipse.swt.internal.Library.loadLibrary(Library.java:240)
at org.eclipse.swt.internal.C.<clinit>(C.java:21)
at org.eclipse.swt.widgets.Display.<clinit>(Display.java:138)
at HelloWorldSWT.main(HelloWorldSWT.java:14)


i found the swt-win32-4234.dll in my exclipse installation and copied it somewhere into my PATH (i have c:\mydlls in the path, and thats where i copied the 2 files to).

Verzeichnis von P:\Programme\eclipse\configuration\org.eclipse.osgi\bundles\363\1\.cp

30.12.2012 10:24 438.272 swt-win32-4234.dll
30.12.2012 10:24 118.784 swt-gdip-win32-4234.dll

Now the HelloWorldSWT executes and opens a windows.

But now i am a bit confused if this is what i have to do? What am i missing?

Next i looked into the "Problems" view which shows me some warnings, and i am not sure, if this is ok:

Description Resource Path Location Type
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1964 Java Problem
There is no 'jre.compilation.profile' build entry and the project has Java compliance preferences set build.properties /org.eclipse.swt.win32.win32.x86 line 1 Plug-in Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1963 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1966 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1965 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1968 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1967 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1970 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1969 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1972 Java Problem
The method getPeer() from the type Component is deprecated SWT_AWT.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/awt line 196 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1971 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1974 Java Problem
The method removeEventListener(OleAutomation, GUID, int, OleListener) from the type OleControlSite is deprecated IE.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/browser line 1973 Java Problem
Build path specifies execution environment CDC-1.0/Foundation-1.0. There are no JREs installed in the workspace that are strictly compatible with this environment. org.eclipse.swt.win32.win32.x86 Build path JRE System Library Problem
Resource leak: 'jar' is never closed Library.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/internal line 185 Java Problem


Finally i tried to start the HelloWorldSWT from a command line.
so i changed to the Workspace\HelloWorldSWT\bin and run:
D:\LCo3\Workspace\HelloWorldSWT\bin>javaw HelloWorldSWT

but here i get some errors regarding SWT Classes:

D:\LCo3\Workspace\HelloWorldSWT\bin>Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/swt/widgets/Display
at HelloWorldSWT.main(HelloWorldSWT.java:14)
Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.widgets.Display
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 1 more

i guess i have to add something to my CLASSPATH. i tried:
D:\LCo3\Workspace\org.eclipse.swt.win32.win32.x86\bin;
and now "javaw HelloWorldSWT" opens the Windows.

Is this changed Classpath correkt?

thx very much for any help for a java/eclipse/swt newcomer.

mario.
Re: SWT Tutorial fails at RunAs (Could not load SWT library) [message #997407 is a reply to message #995532] Mon, 07 January 2013 10:42 Go to previous messageGo to next message
Stephane Begaudeau is currently offline Stephane BegaudeauFriend
Messages: 458
Registered: April 2010
Location: Nantes (France)
Senior Member

Hi Mario,

First, I see that you have an issue regarding the configuration of the Java Runtime Environment of your Java project:
Quote:
Build path specifies execution environment CDC-1.0/Foundation-1.0. There are no JREs installed in the workspace that are strictly compatible with this environment. org.eclipse.swt.win32.win32.x86 Build path JRE System Library Problem


While it may not be the cause of your problem, you can easily change the JRE that your project is using to fix this.

Now, for the root of your problem, a quick search is suggesting that the issue lies in the dependency between your code and SWT. As Craig Williams is suggesting it in this message:
Quote:
the solution lay in the step of the tutorial titled 'Configure the Java project'. Go into the project Properties and select Java Build Path then make sure you are in the Projects tab where you added the SWT project earlier. Expand the reference to the SWT project. Where is says Native library location I found that when I followed the tutorial it said (None). I clicked Edit and found the SWT project in my workspace obviously when I added it earlier in the tutorial. Select this and click OK.


Regards,

Stephane Begaudeau, Obeo

--
Twitter: @sbegaudeau
Google+: +stephane.begaudeau
Blog: http://stephanebegaudeau.tumblr.com | Eclipse Java Development Tools Tips and Tricks
Re: SWT Tutorial fails at RunAs (Could not load SWT library) [message #998573 is a reply to message #997407] Thu, 10 January 2013 09:19 Go to previous message
mario semo is currently offline mario semoFriend
Messages: 2
Registered: December 2012
Junior Member
Hi Stephane,

First, thanks a lot for your reply. You fixed the problem i had with the SWT tutorial. As i have seen in the thread you referenced, the same problem had a lot of other people too. So are we all missing something in the tutorial description?

Regarding the other problem i have no idea how to fix this warning.

Description:
Build path specifies execution environment CDC-1.0/Foundation-1.0. There are no JREs installed in the workspace that are strictly compatible with this environment.
Source: org.eclipse.swt.win32.win32.x86
Creation Time: 30. Dezember 2012 11:33:47

I opened org.eclipse.swt.win32.win32.x86 -> JRT -> execution environment and changed it to JRE1.7 SE.

Now this above problem is gone, but now i have 164 warnings....
(thats why i write, that i have no idea how to fix this problem).
and: this org.clipse.swt.win32.win32.x86 is imported for the tutorial.

See the attached png for what i changed.

The warnings all occur somewhere inside java rt like:

Description Resource Path Location Type
Class is a raw type. References to generic type Class<T> should be parameterized Display.java /org.eclipse.swt.win32.win32.x86/src/org/eclipse/swt/widgets line 1685 Java Problem

so the question is: how to correctly fix this problem?

best regards,
mario.
Previous Topic:RSA questions
Next Topic:One problem after another
Goto Forum:
  


Current Time: Tue Mar 19 08:05:34 GMT 2024

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

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

Back to the top