Cocoa SWT Not working? [message #899206] |
Tue, 31 July 2012 05:24 |
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 #905232 is a reply to message #899742] |
Thu, 30 August 2012 00:46 |
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.
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 6.27053 seconds