|java.library.path settings when running an SWT application [message #467725]
||Sun, 05 February 2006 00:31
Originally posted by: az1.sbcglobal.net|
I'm an Eclipse newbie, so please be lenient, if hte question is
obvious/stupid/does not belong here.
I'm working on a little Windows application, which uses SWT for GUI and a
third-party native Java drivers (1wire drivers from Maxim / Dallas Semi:
http://www.maxim-ic.com/products/ibutton/software/tmex/). The application
without the SWT runs just fine, as does the SWT part without the 1wire part.
When I run the application (with both SWT and 1wire) under Eclipse, I get:
Native drivers not found, download iButton-TMEX RTE Win32 from
So I investigate, and find out that the java.library.path is set to the
Eclipse cache, which holds the SWT
No attempts to fix the problem help: I copied all the necessary DLLs to the
cache where the SWT DLLs are; I tried to add -Djava.library.path variable
to the VM arguments - no luck at all: the call to
java.lang.UnsatisfiedLinkError: no ibtmjava.dll in java.library.path
--this despite teh fact that the ibtmjava.dll is right there in the
directory pointed to by the java.library.path property.
When I run a non-SWT application, the java.library.path is my %PATH%
variable, prepended by %JAVA_HOME%\bin, and the drivers are found without
any problem. But when I try to set the VM argument to:
-Djava.library.path=E:\eclipse\WS\.metadata\.plugins\org.ecl ipse.ve.java.core\.cache\.libCache\-792275406;C:\j2sdk1.4.2_ 08\bin;.;C:\WINDOWS\system32
- the System.loadLibrary still fails
|Re: java.library.path settings when running an SWT application [message #467730 is a reply to message #467728]
||Sun, 05 February 2006 10:45
Originally posted by: az1.sbcglobal.net|
Thanks, Alex, for pointing out my error in naming the DLLs.
I forgot to mention that all the required DLLs are in the windows PATH
(WINDOWS\system32), but they are still not found, when running the SWT
application. If it's not using SWT, just regular Java - everything is fine,
they are found and loaded without the System.loadLibrary().
I ran System.loadLibrary out of desperation to force the loading by the SWT
application. I also printed out the value of the java.library.path property
in both cases. When running an SWT application the value is the .cache
directory. For a regular Java application the value is my %PATH%. I tried
to explicitly set the java.library.path in the VM arguments window of the
Load Configuration dialog to include both hte .cache and the PATH - without
success, the DLLs were still not found!
"Alex Blewitt" <email@example.com> wrote in message
> Don't point to a .cache directory. It's temporary and gets cleaned etc.
> You should instead download the SWT jar on its own and use that
> Secondly, you don't put .dll on the end of a call to System.loadLibrary().
> It will be trying to load ibtmjava.dll.dll.
> Thirdly, some drivers have to be in the windows PATH to load, especially
> for DLLs that must load other DLLs. E.g. if ibtmjava.dll depends on
> ibxx.dll, and they're both in the same directory, it doesn't matter where
> java.library.path points to; if the windows PATH doesn't contain that
> directory then it won't be able to get it. This can be solved in Java if
> you find out (a) what the dependencies are, and (b) do
> System.loadLIbrary("ibxx") followed by System.loadLibrary("ibtmjava"), but
> that presupposes that you know the dependency tree. (Microsoft
> VisualStudio has a tool called dependency walker that you can use to find
> out should you happen to have it installed).
|Re: java.library.path settings when running an SWT application [message #467744 is a reply to message #467730]
||Sun, 05 February 2006 17:30
| Alex Blewitt
Registered: July 2009
Just to be clear; when running from within Eclipse, you *can't* refer to %PATH%. That's a MS-Dos (command.com) thing, and Eclipse will have nothing to do with it. Obviously specifying it by copy-and-pasting the value will work fine, though ;-)|
I have seen this before when a.dll needs to load b.dll, but b.dll isn't in the PATH. Even if they're both in the java.library.path, there's the problem.
How are you launching it? Are you right-clicking on the program and doing 'Run as SWT application'? Or is it part of a plugin (you've not indicated that it is so far, but plugins work differently with DLLs so it's useful to get it out of the way). Running as an RCP app counts as a plugin :-)
If you are still having problems, can you send me a screenshot of the (a) launch configuration dialog at the arguments page, and (b) the snippet(s) of code that are doing the launching, as well as the project layout and location of DLLs there.
Powered by FUDForum
. Page generated in 0.09485 seconds