Hello World SWT - Could not load SWT library [message #754988] |
Sun, 06 November 2011 12:59  |
Eclipse User |
|
|
|
Hello All,
I just "installed" Eclipse for RCP and RAP Developers and wanted to do the "Hello World SWT" tutorial.
I am getting the following error when i run the application.
Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-win32-3738 in java.library.path
no swt-win32 in java.library.path
Can't load library: C:\Users\Willem\.swt\lib\win32\x86\swt-win32-3738.dll
Can't load library: C:\Users\Willem\.swt\lib\win32\x86\swt-win32.dll
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.widgets.Display.<clinit>(Display.java:138)
at HelloWorldSWT.main(HelloWorldSWT.java:13)
I think this might has something to do with my %PATH% variable, or my runtime environment , but i'm not really sure.
I downloaded the latest java JDK from the oracle site ( Java SE 7u1 )
I updated my eclipse.ini , as suggested in the newcomers sticky .
My eclipse.ini file looks like this:
-startup
plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
-product
org.eclipse.epp.package.rcp.product
--launcher.defaultAction
openFile
--launcher.XXMaxPermSize
256M
-showsplash
org.eclipse.platform
--launcher.XXMaxPermSize
256m
--launcher.defaultAction
openFile
-vm
C:\Program Files\Java\jdk1.7.0_01\bin\javaw.exe
-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx512m
I am running windows 7 professional 32 bit.
Any help would be greatly appreciated, thanks in advanced !
[Updated on: Sun, 06 November 2011 14:30] by Moderator Report message to a moderator
|
|
|
Re: Hello World SWT - Could not load SWT library [message #754994 is a reply to message #754988] |
Sun, 06 November 2011 14:16   |
Eclipse User |
|
|
|
On 2011.11.06 5:59, willem wrote:
> Hello All,
>
> I just "installed" Eclipse for RCP and RAP Developers and wanted to do
> the "Hello World SWT" tutorial.
>
> [snip]
>
> I updated my eclipse.ini , as suggested in the newcomers sticky .
> My eclipse.ini file looks like this:
> -startup
> plugins/org.eclipse.equinox.launcher_1.2.0.v20110502.jar
> --launcher.library
> plugins/org.eclipse.equinox.launcher.win32.win32.x86_1.1.100.v20110502
> -product
> org.eclipse.epp.package.rcp.product
> --launcher.defaultAction
> openFile
> --launcher.XXMaxPermSize
> 256M
> -showsplash
> org.eclipse.platform
> --launcher.XXMaxPermSize
> 256m
> --launcher.defaultAction
> openFile
> -vmargs
> -Dosgi.requiredJavaVersion=1.5
> -Xms40m
> -Xmx512m
> -vm
> C:\Program Files\Java\jdk1.7.0_01\bin\javaw.exe
> I added the last two lines, but that doesn't seem to do anything.
> I am running windows 7 professional 32 bit.
>
> Any help would be greatly appreciated, thanks in advanced !
Hey, this may be a little off-topic (i.e.: it may not cure your original
complaint), but I'm pretty sure that you must put
-vm
C:\Program Files\Java\jdk1.7.0_01\bin\javaw.exe
before the -vmargs section in eclipse.ini.
|
|
|
|
Re: Hello World SWT - Could not load SWT library [message #761182 is a reply to message #754988] |
Tue, 06 December 2011 03:28   |
Eclipse User |
|
|
|
Hello
I have got exactly the same problem! Bad for a first SWT example for newbies
Anyway there is a working solution for me (My SDK is eclipse-SDK-3.7.1-win32.zip)
Follow the explanations given on the link below
to add swt-3.7.1-win32-win32-x86.zip to your Eclipse
(in case you are in Windows 32bit)
www.badprog.com/eclipse-standard-widget-toolkit-swt-installation
There are probably other solutions using the java.library.path
lol : I cannot use links until I have posted more than 5 messages so you may have to add h t t p : / / by yourself.
Another collateral damage of the war against spam...
|
|
|
Re: Hello World SWT - Could not load SWT library [message #762787 is a reply to message #761182] |
Thu, 08 December 2011 16:16   |
Eclipse User |
|
|
|
The solution didn't work for me. First it told me that it couldn't add the project that was already there, org.eclipse.swt. So I deleted org.eclipse.swt and org.eclipse.swt.win32.win32.x86 and tried that import again. But it only added org.eclipse.swt and not org.eclipse.swt.win32.win32.x86, which I still had to add again the way the tutorial tells. Not working, so again I tried just deleting org.eclipse.swt and following the "solution" instructions again.
After another whinge that swt-win32-3738 was not found (even thought it is in Workspace\org.eclipse.swt.win32.win32.x86 as a .dll), I picked on the message Can't load library: .swt\lib\win32\x86\swt-win32-3738.dll and copied the file there. Now it works. But something doesn't feel right.
It seems to me that this is not meant to be the solution. If the file belongs there, why wasn't it there in the first place? If it doesn't, my solution is dirty/messy, especially is I have to do the same thing again and again. Anyway, the file is in the root of the project org.eclipse.swt.win32.win32.x86, so why wasn't it used from there? Does it really belong there? Are some paths set wrong? Is the problem in the project itself or in Eclipse?
In short - what is wrong / what am I doing wrong? Help!
Tom
|
|
|
Re: Hello World SWT - Could not load SWT library [message #794878 is a reply to message #762787] |
Thu, 09 February 2012 20:24   |
Eclipse User |
|
|
|
Hi,
I found this thread after trying the HelloWorldSWT tutorial myself and coming across the exact same problem.
For me 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.
Your project should now be able to run.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Hello World SWT - Could not load SWT library [message #984306 is a reply to message #977665] |
Wed, 14 November 2012 15:32   |
Eclipse User |
|
|
|
+1 Craig Williams, although for me it didn't really help - but now I know where that is!
I must of missed an installation step because the default place it was looking for the swt library was
and there weren't any libraries in there. So I did:
find ~/local/eclipse/ -name libswt\*.so -exec cp {} ~/.swt/lib/linux/x86/ \;
and now it runs fine without explicitly setting the location of the shared libs. I could have set the path explictly to where the libs were found in the eclipse directory, but they are at:
eclipse/configuration/org.eclipse.osgi/bundles/193/1/.cp
which is kind of an odd place, hidden directory and all.
-jim
|
|
|
Re: Hello World SWT - Could not load SWT library [message #991761 is a reply to message #794878] |
Thu, 20 December 2012 06:10   |
Eclipse User |
|
|
|
Craig Williams wrote on Thu, 09 February 2012 15:24Hi,
I found this thread after trying the HelloWorldSWT tutorial myself and coming across the exact same problem.
For me 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.
Your project should now be able to run.
You sir are a godsend. I'm pretty new to CS and I've been wreaking my brain for 3 days trying to figure this out.
Since the instructions were a little vague I'll will try to restate what he said:
In Package Exporer >> Right click your SWT project >> Properties >> On the left pane, select "Java Build Path" >> In the right window go to the "Projects" tab >> Expand the "org.eclipse.swt.win32.win32.x86" project in the box >> Select "Native Library Location" >> Click on "Edit" on the right hand side >> Click on "Workspace" >> Select the "org.eclipse.swt.win32.win32.x86" object (don't expand it) >> click "OK"
Thanks again!
|
|
|
|
|
|
|
|
|
|
|
|
|
Re: Hello World SWT - Could not load SWT library [message #1388771 is a reply to message #794878] |
Thu, 26 June 2014 23:24   |
Eclipse User |
|
|
|
Craig Williams wrote on Thu, 09 February 2012 15:24Hi,
I found this thread after trying the HelloWorldSWT tutorial myself and coming across the exact same problem.
For me 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.
Your project should now be able to run.
Long overdue, sure, but Craig Williams was (is?) genius on this point.
Fixed me!
|
|
|
|
Powered by
FUDForum. Page generated in 0.56464 seconds