|Re: How to get both SWT and my own native libraries in Eclipse Run... [message #466691 is a reply to message #466604]
||Fri, 13 January 2006 14:56
| Veronika Irvine
Registered: July 2009
It all depends on where the SWT you are running against comes from.|
If you are using SWT from the plugin that is part of your Java IDE, then you
can use Run As SWT Application. This will find the SWT dlls for you. You
can find your own dll by setting -Djava.library.path+C:\path\to\my\dll in
the VM argments field of the launch configuration dialog (Run As -> SWT
Application ... brings up a dialog and you enter this is in the VM
Alternatively, you can use the SWT from the standalone SWT binary doaloads
(e.g. ). The you can just import the archive file as a project and the dll
path will be automatically set up by the following line in the classpath
<classpathentry kind="src" path="Eclipse SWT PI/win32">
(Note, you can add a similar line to your own classpath to export your dll
and then you will not need to modify the VM arguments for every launch).
Here is a link to the 3.1.1 version of the SWT standalone binary:
"Kenneth Evans" <email@example.com> wrote in message
>I am having trouble getting an SWT program to find my own native libraries
> using Run... in Eclipse.
> If it were a Swing application running in Eclipse, the java.library.path
> would be my PATH, and it would find my libraries (and work).
> However, for an SWT application, Eclipse 3.11 makes the java.library.path
> something like:
> ...\Work\.metadata\.plugins\org.eclipse.ve.java.core\.cache\ .libCache\-79227
> and it changes each time, as well.
> It then cannot find my libraries. I assume this has something to do with
> extracting the .dll's from the jar files.
> How do I get around this and get my PATH to be part of the
> and still get the SWT libraries. Presumably I could
> set -Djava.library.path, but I don't know what to set it to get the SWT
|Re: How to get both SWT and my own native libraries in Eclipse Run... [message #466694 is a reply to message #466691]
||Fri, 13 January 2006 17:53
| Kenneth Evans, Jr.
Registered: July 2009
"Veronika Irvine" <firstname.lastname@example.org> wrote in message|
> It all depends on where the SWT you are running against comes from.
> If you are using SWT from the plugin that is part of your Java IDE, then
> can use Run As SWT Application. This will find the SWT dlls for you. You
> can find your own dll by setting -Djava.library.path+C:\path\to\my\dll in
> the VM argments field of the launch configuration dialog (Run As -> SWT
> Application ... brings up a dialog and you enter this is in the VM
> arguements section).
Thanks for your reply. I am not at this time using the standalone SWT
binary downoads, so I will respond to the first part. I also no longer have
an SWT plug-in in my Workspace. It doesn't seem to be necessary and doesn't
seem advisable for an RCP application. It is enough to add SWT to the
I have a program that uses either a JNI implementation or a Java
implementation of one part of it (not the SWT part). With the Java
implementation, it works fine and it finds the SWT DLLs as I described.
With the JNI implementation, it still finds the SWT DLLs but doesn't find
mine. If I set -Djava.library.path=C:\path\to\my\dll as you suggest, it no
longer finds the SWT DLLs (but it does find mine).
The bottom line is that your suggestion does not work. I have already tried
Apparently Eclipse is setting the java.library.path to where it extracts the
DLLs from the jar. It is ignoring the fact that this destroys the default
behavior of using PATH for the java.library.path. I would consider this a
Since writing the original message, I have found that if I add the cache
directory (with the long name and number) that it normally uses
to -Djava.library.path along with C:\path\to\my\dll , then it works (so
far). This is rather tedious as I have to write code in the program to
print out what Eclipse used, then copy it to the Run... configuration, then
remove that code. I am not sure how the project will port to other
computers. I also have no idea when Eclipse will change the cache directory
(C:\Documents and Settings\evans\My
ibCache\-79227540, in my case).
BTW with "Run As SWT application" Eclipse uses yet another
java.library.path (as determined by printing it from the code). I also do
not get the dialog for the VM arguments you mention, but these can be
entered in the Run... configuration dialog.
Powered by FUDForum
. Page generated in 0.01937 seconds