Skip to main content



      Home
Home » Newcomers » Newcomers » How do I tell eclipse how to find the SWT native libraries
How do I tell eclipse how to find the SWT native libraries [message #239696] Sun, 04 November 2007 11:55 Go to next message
Eclipse UserFriend
Originally posted by: James.Watrous.MatrixOne.com

I am new to SWT and have only used the basics in Eclipse. I am working
on a Windows XP-Pro SP2 machine with Eclipse 3.2.1. I created my “Hello
World” program for SWT as follows:

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;

public class hello {

public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
Label label = new Label(shell, SWT.CENTER);
label.setText("Hello, World");
label.setBounds(shell.getClientArea());
shell.open();
while (!shell.isDisposed()){
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
}

I added the external jar file
“org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” from my
“eclipse/plugins” directory to the “Libraries” tab of the
“Project->Properties-> Java Build Path” Dialog. I did not add any JVM
arguments on the Run dialog.

The project now builds, but I get a “no swt-win32-3236 in
java.library.path” error at run time.

I then extracted all the .dlls from
“org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” (swt-win32-3236.dll,
swt-awt-win32-3236.dll, swt-gdip-win32-3236.dll, swt-wgl-win32-3236.dll)
and placed them in a new directory (c:\SWT_dlls) and added this path to
the “Native Library Location” element that appeared under the
“org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” object that was added
to the “Project->Properties-> Java Build Path->Libraries” tab above.

The program now runs.

Should I be extracting the dlls from the jar, or is there a way to run
with them still inside the SWT jar file? How does Eclipse find the SWT
native libraries?
Re: How do I tell eclipse how to find the SWT native libraries [message #239731 is a reply to message #239696] Mon, 05 November 2007 02:10 Go to previous messageGo to next message
Eclipse UserFriend
Jim,

You'd be better of use SWT from 3.3 because then SWT takes care itself
to extract the .dlls and resolve them appropriately.

Tom

Jim Watrous schrieb:
> I am new to SWT and have only used the basics in Eclipse. I am working
> on a Windows XP-Pro SP2 machine with Eclipse 3.2.1. I created my “Hello
> World” program for SWT as follows:
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Label;
> import org.eclipse.swt.widgets.Shell;
>
> public class hello {
>
> public static void main(String[] args) {
> Display display = new Display();
> Shell shell = new Shell(display);
> Label label = new Label(shell, SWT.CENTER);
> label.setText("Hello, World");
> label.setBounds(shell.getClientArea());
> shell.open();
> while (!shell.isDisposed()){
> if (!display.readAndDispatch()) {
> display.sleep();
> }
> }
> display.dispose();
> }
> }
>
> I added the external jar file
> “org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” from my
> “eclipse/plugins” directory to the “Libraries” tab of the
> “Project->Properties-> Java Build Path” Dialog. I did not add any JVM
> arguments on the Run dialog.
>
> The project now builds, but I get a “no swt-win32-3236 in
> java.library.path” error at run time.
>
> I then extracted all the .dlls from
> “org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” (swt-win32-3236.dll,
> swt-awt-win32-3236.dll, swt-gdip-win32-3236.dll, swt-wgl-win32-3236.dll)
> and placed them in a new directory (c:\SWT_dlls) and added this path to
> the “Native Library Location” element that appeared under the
> “org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” object that was added
> to the “Project->Properties-> Java Build Path->Libraries” tab above.
>
> The program now runs.
>
> Should I be extracting the dlls from the jar, or is there a way to run
> with them still inside the SWT jar file? How does Eclipse find the SWT
> native libraries?


--
B e s t S o l u t i o n . at
------------------------------------------------------------ --------
Tom Schindl JFace-Committer
------------------------------------------------------------ --------
Re: How do I tell eclipse how to find the SWT native libraries [message #239769 is a reply to message #239731] Mon, 05 November 2007 10:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: James.Watrous.MatrixOne.com

Tom,
Thank you very much. That did solve the problem. Apparently SWT is doing
some magic if System.loadLibrary("swt-win32-xxxx") fails in the 3.3 version.


Tom Schindl wrote:
> Jim,
>
> You'd be better of use SWT from 3.3 because then SWT takes care itself
> to extract the .dlls and resolve them appropriately.
>
> Tom
>
> Jim Watrous schrieb:
>> I am new to SWT and have only used the basics in Eclipse. I am working
>> on a Windows XP-Pro SP2 machine with Eclipse 3.2.1. I created my
>> “Hello World” program for SWT as follows:
>>
>> import org.eclipse.swt.SWT;
>> import org.eclipse.swt.widgets.Display;
>> import org.eclipse.swt.widgets.Label;
>> import org.eclipse.swt.widgets.Shell;
>>
>> public class hello {
>>
>> public static void main(String[] args) {
>> Display display = new Display();
>> Shell shell = new Shell(display);
>> Label label = new Label(shell, SWT.CENTER);
>> label.setText("Hello, World");
>> label.setBounds(shell.getClientArea());
>> shell.open();
>> while (!shell.isDisposed()){
>> if (!display.readAndDispatch()) {
>> display.sleep();
>> }
>> }
>> display.dispose();
>> }
>> }
>>
>> I added the external jar file
>> “org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” from my
>> “eclipse/plugins” directory to the “Libraries” tab of the
>> “Project->Properties-> Java Build Path” Dialog. I did not add any JVM
>> arguments on the Run dialog.
>>
>> The project now builds, but I get a “no swt-win32-3236 in
>> java.library.path” error at run time.
>>
>> I then extracted all the .dlls from
>> “org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” (swt-win32-3236.dll,
>> swt-awt-win32-3236.dll, swt-gdip-win32-3236.dll,
>> swt-wgl-win32-3236.dll) and placed them in a new directory
>> (c:\SWT_dlls) and added this path to the “Native Library Location”
>> element that appeared under the
>> “org.eclipse.swt.win32.win32.x86_3.2.2.v3236.jar” object that was
>> added to the “Project->Properties-> Java Build Path->Libraries” tab
>> above.
>>
>> The program now runs.
>>
>> Should I be extracting the dlls from the jar, or is there a way to run
>> with them still inside the SWT jar file? How does Eclipse find the SWT
>> native libraries?
>
>
Re: How do I tell eclipse how to find the SWT native libraries [message #240100 is a reply to message #239769] Thu, 08 November 2007 21:44 Go to previous message
Eclipse UserFriend
Originally posted by: James.Watrous.3ds.com

The
Previous Topic:JSP version mismatch: auto-complete versus build
Next Topic:Eclipse does not work on my 64 bit machine
Goto Forum:
  


Current Time: Sun Jun 08 15:40:17 EDT 2025

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

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

Back to the top