Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Newcomers » Newcomers » Cocoa SWT Not working?
icon5.gif  Cocoa SWT Not working? [message #899206] Tue, 31 July 2012 05:24 Go to next message
Edward Rech is currently offline Edward Rech
Messages: 4
Registered: July 2012
Junior Member
Why is it not working? I did all by the tutorial. Here is my console. I am using Eclipse Juno.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-cocoa-4233 in java.library.path
no swt-cocoa in java.library.path
Can't load library: /Users/fryselectronics/.swt/lib/macosx/x86_64/libswt-cocoa-4233.jnilib
Can't load library: /Users/fryselectronics/.swt/lib/macosx/x86_64/libswt-cocoa.jnilib

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:101)
at HelloWorldSWT.main(HelloWorldSWT.java:13)

[Updated on: Tue, 31 July 2012 05:25]

Report message to a moderator

Re: Cocoa SWT Not working? [message #899213 is a reply to message #899206] Tue, 31 July 2012 06:25 Go to previous messageGo to next message
Eduardo Nader is currently offline Eduardo Nader
Messages: 1
Registered: July 2012
Junior Member
Same here.

Here my console, following the exact steps at the tutorial.

Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-cocoa-4233 in java.library.path
no swt-cocoa in java.library.path
Can't load library: /Users/lalo/.swt/lib/macosx/x86_64/libswt-cocoa-4233.jnilib
Can't load library: /Users/lalo/.swt/lib/macosx/x86_64/libswt-cocoa.jnilib

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:101)
at HelloWorldSWT.main(HelloWorldSWT.java:12)


By the way: I´m using Montain Lion. I do not know if this may be the cause.

Regards.
Re: Cocoa SWT Not working? [message #899234 is a reply to message #899213] Tue, 31 July 2012 07:57 Go to previous messageGo to next message
Edward Rech is currently offline Edward Rech
Messages: 4
Registered: July 2012
Junior Member
Mountain Lion HAS NOTHING to do with this. I am using Snow Leopard 10.6 myself, so nope. :S
Too bad :/. I guess I will have to learn how to use swing then... *sigh*.
Anyone knows what to do?

[Updated on: Tue, 31 July 2012 07:58]

Report message to a moderator

Re: Cocoa SWT Not working? [message #899742 is a reply to message #899206] Thu, 02 August 2012 07:42 Go to previous messageGo to next message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2308
Registered: July 2009
Senior Member
What tutorial?

---
Nitin Dahyabhai
Eclipse WTP, IBM
Re: Cocoa SWT Not working? [message #905232 is a reply to message #899742] Thu, 30 August 2012 00:46 Go to previous messageGo to next message
Deven Kelling is currently offline Deven Kelling
Messages: 1
Registered: August 2012
Junior Member
It's the tutorial to create an SWT Hello World Application.

Quote:

This cheat sheet shows you how to create a "Hello World" application that uses the Standard Widget Toolkit (SWT). The application will simply display an empty window to the user.
If you need help at any step, click the (?) to the right. Let's get started!

If you're not already in the Java perspective, in the main menu select Window > Open Perspective > Java or click on the "Click to Perform" link below.

Open the Import wizard from the main menu via File > Import..., and select Plug-in Development > Plug-ins and Fragments. Click Next.
On the Import Plug-ins and Fragments page, select
Import from: The active target platform.
Plug-ins and Fragments to import: Select from all plug-ins and fragments found at specified location.
Import As: Projects with source folders.
Click Next.
On the Selection page, Add org.eclipse.swt.{platform}.{os}.{arch} (for example: org.eclipse.swt.win32.win32.x86 for win32) to Plug-ins and Fragments to Import: list.
Click Finish.
This will create the org.eclipse.swt.{platform}.{os}.{arch} project which we will need to compile and run the application.

Now we need a project to store our own source code. In the main toolbar, click on the New Java Project button, or click on the link below. Enter HelloWorldSWT for the project name, then click Finish.

Since our project requires SWT, we need to specify this in the project properties. Right-click on the project and select Properties.
In the Java Build Path page open the Projects tab, add the org.eclipse.swt.{platform}.{os}.{arch} project, then click OK.

The next step is to create a new class. In the main toolbar, click on the New Java Class button (or the link below). If not already specified, select HelloWorldSWT/src as the source folder. Enter HelloWorldSWT for the class name and select the checkbox to create the main() method, then click Finish.
The Java editor will automatically open showing your new class.

In the Java editor, enter the following Java code in the main() method:
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello world!");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
You will get compile errors. Right click in the Java editor and select Source > Organize Imports, then save your changes.

To run your application, right-click on your class in the Package Explorer and select Run As > Java Application. A new empty window should appear with the title "Hello world!".
Congratulations! You have successfully created a Hello World SWT application!



The consol reads:

Quote:


Exception in thread "main" java.lang.UnsatisfiedLinkError: Could not load SWT library. Reasons:
no swt-cocoa-4233 in java.library.path
no swt-cocoa in java.library.path
Can't load library: /Users/devenkelling/.swt/lib/macosx/x86_64/libswt-cocoa-4233.jnilib
Can't load library: /Users/devenkelling/.swt/lib/macosx/x86_64/libswt-cocoa.jnilib

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:101)
at HelloWorldSWT.main(HelloWorldSWT.java:11)



This is Eclipse 2.4.0
Build id: I20120608-1400

I'm using Mac OSX 10.7.4
running on a 2.4 GHz Intel Core 2 Duo Processor, which is a 64 bit processor.
I installed the 64 bit version, could it be that I should have chosen 32 bit?

The folder x86_64 exists in my directory, but its empty. 'ls -a' reveals nothing



Please advise.
Re: Cocoa SWT Not working? [message #906397 is a reply to message #905232] Sat, 01 September 2012 10:43 Go to previous messageGo to next message
yi logic is currently offline yi logic
Messages: 1
Registered: September 2012
Junior Member
The same problem! Any advise?
Regards!
Re: Cocoa SWT Not working? [message #908129 is a reply to message #899206] Tue, 04 September 2012 19:46 Go to previous messageGo to next message
Ace Ace is currently offline Ace Ace
Messages: 1
Registered: September 2012
Junior Member
Here's what worked for me:

Right Click on your Project Folder of your HelloWorldSWT Project-> Properties -> Java Build Path -> Tab 'Projects'

Expand the 'org.eclipse.swt.cocoa.macosx.x86_64' folder by clicking on the arrow left to it

Select 'Native library location' and click Edit

Click the Workspace Button and select 'org.eclipse.swt.cocoa.macosx.x86_64', then click ok (serveral times).

That did the trick ... Ma-an
Re: Cocoa SWT Not working? [message #1233824 is a reply to message #908129] Mon, 20 January 2014 15:23 Go to previous message
Bernie Watts is currently offline Bernie Watts
Messages: 1
Registered: January 2014
Junior Member
You're a genius. What did all that do?
Previous Topic:can't load deployment descriptor
Next Topic:Photran refactoring
Goto Forum:
  


Current Time: Wed Oct 22 15:40:00 GMT 2014

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

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