M
Matthew Zimmer
Hey all,
I have a strange issue I'm trying to figure out and could really use
some help. I've tried everything I can think of and am not having much
luck. Here's the scenario: I've created a dll called Win32Registry.dll
to allow me to add keys to the windows registry. I have a class called
Win32RegKey in package win32regkey. I've created a jar called
Win32Registry.jar with my Win32RegKey class in it. Win32RegKey has the
call System.loadLibrary("Win32Registry") in it.
Now, when I run a test program from test.Test that creates a key
everything works fine. However, the dll and the jar file are in the
same directory that I'm running from and the classpath includes "." in it.
Now, when I take the same dll and jar file and drop them into a lib
directory in my main project I start having some problems. Oh, I'm
using JBuilder8 by the way. I include Win32Registry.jar in my project
path, but can't include Win32Registry.dll in it since JB8 doesn't let
you do that. Anyway, when I try to access the same code that I did
through test.Test I get the following exception:
java.lang.UnsatisfiedLinkError: no Win32Registry in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at win32regkey.Win32RegKey.<clinit>(Win32RegKey.java:82)
at com.mypackage.MyClass.doStuff(MyClass.java:26)
...
Now, if I put the dll file in my working directory things are okay. But
here's the part that really bothers me about that. Previously I was
using jst.jar and jst.dll which contain registry code that unfortunately
does not allow you to add a new key (which is why I had to write my
own). I'm assuming that somewhere in jst.jar the code must call
System.loadLibrary("jst"). Now, I have the exact same setup with jst in
that the jst.jar file is in my project path, and the jst.dll is not but
they are both in my lib directory. Everything works fine with jst.
My question is this: am I doing something wrong with either the
creation of my dll or my jar file (I'm using the standard jar -cvf ...
stuff for the jar file and gcc for the dll) or is the System.loadLibrary
call wrong. Can you pass a relative path to that...maybe something like
"System.loadLibrary("./Win32Registry")"? I've tried that particular
example but maybe there is some other way to do it that I just don't know.
Anyway, that's the problem that I'm facing right now. I'd sure
appreciate any help that somebody out there might be able to give me.
This is really starting to frustrate me. Thanks for any help.
Matthew
I have a strange issue I'm trying to figure out and could really use
some help. I've tried everything I can think of and am not having much
luck. Here's the scenario: I've created a dll called Win32Registry.dll
to allow me to add keys to the windows registry. I have a class called
Win32RegKey in package win32regkey. I've created a jar called
Win32Registry.jar with my Win32RegKey class in it. Win32RegKey has the
call System.loadLibrary("Win32Registry") in it.
Now, when I run a test program from test.Test that creates a key
everything works fine. However, the dll and the jar file are in the
same directory that I'm running from and the classpath includes "." in it.
Now, when I take the same dll and jar file and drop them into a lib
directory in my main project I start having some problems. Oh, I'm
using JBuilder8 by the way. I include Win32Registry.jar in my project
path, but can't include Win32Registry.dll in it since JB8 doesn't let
you do that. Anyway, when I try to access the same code that I did
through test.Test I get the following exception:
java.lang.UnsatisfiedLinkError: no Win32Registry in java.library.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1403)
at java.lang.Runtime.loadLibrary0(Runtime.java:788)
at java.lang.System.loadLibrary(System.java:832)
at win32regkey.Win32RegKey.<clinit>(Win32RegKey.java:82)
at com.mypackage.MyClass.doStuff(MyClass.java:26)
...
Now, if I put the dll file in my working directory things are okay. But
here's the part that really bothers me about that. Previously I was
using jst.jar and jst.dll which contain registry code that unfortunately
does not allow you to add a new key (which is why I had to write my
own). I'm assuming that somewhere in jst.jar the code must call
System.loadLibrary("jst"). Now, I have the exact same setup with jst in
that the jst.jar file is in my project path, and the jst.dll is not but
they are both in my lib directory. Everything works fine with jst.
My question is this: am I doing something wrong with either the
creation of my dll or my jar file (I'm using the standard jar -cvf ...
stuff for the jar file and gcc for the dll) or is the System.loadLibrary
call wrong. Can you pass a relative path to that...maybe something like
"System.loadLibrary("./Win32Registry")"? I've tried that particular
example but maybe there is some other way to do it that I just don't know.
Anyway, that's the problem that I'm facing right now. I'd sure
appreciate any help that somebody out there might be able to give me.
This is really starting to frustrate me. Thanks for any help.
Matthew