java.lang.UnsatisfiedLinkError:
807606May 21 2007 — edited May 21 2007Hi
I have wriiten a program for writing and reading from the registry
My code use a DLL file and a jar file.I am using eclipse as my ide
when i run my program from eclipse its working properly
but when i make a jar of my code and excecute its givein me
java.lang.UnsatisfiedLinkError:
My code is given below
import ca.beq.util.win32.registry.RegistryKey;
import ca.beq.util.win32.registry.RegistryValue;
import ca.beq.util.win32.registry.RootKey;
import ca.beq.util.win32.registry.ValueType;
public class CheckRegistry {
public static String Version = "MG 3.4.13.1";
public static String DBVersion = "DB 3.4.1.1";
public static String BuildDate = "05/14/2007";
public static void writeToRegistry(String component1) {
String pathV = "Software\\ABC Inc\\Enterprise \\"
+ component1;
RegistryKey r = new RegistryKey
(RootKey.HKEY_LOCAL_MACHINE, pathV);
if (!r.exists()) {
r.create();
RegistryValue version = new RegistryValue("Version",
ValueType.REG_SZ, Version);
RegistryValue path = new RegistryValue("InstallPath",
ValueType.REG_SZ, System.getProperty("user.dir"));
RegistryValue dbversion = new RegistryValue
("DBSchemaVersion",
ValueType.REG_SZ, DBVersion);
r.setValue(version);
r.setValue(path);
r.setValue(dbversion);
System.out.println("Wrote Succesfully to Registry");
} else {
// Need to update the software
}
}
public void readFromRegistry(String component) {
String pathV = "Software\\ABC \\Enterprise\\"
+ component; RegistryKey r = new RegistryKey
(RootKey.HKEY_LOCAL_MACHINE, pathV);
System.out.println("Path = " + pathV);
if (r.exists()) {
if (r.hasValue("Version")) {
RegistryValue v = r.getValue("Version");
System.out.println(v.toString());
}
if (r.hasValue("InstallPath")) {
RegistryValue v = r.getValue("InstallPath");
System.out.println(v.toString());
}
if (r.hasValue("DBSchemaVersion")) {
RegistryValue v = r.getValue("DBSchemaVersion"); System.out.println(v.toString());
}
} else {
System.out.println("Error-----");
}
}
static {
System.loadLibrary("jRegistryKey");
System.out.println("Sucessfully Loaded The DLL ");
}
public static void main(String args[]) {
new CheckRegistry().readFromRegistry("Manager");
}
}
the error i m gettin is
Exception in thread "main" java.lang.UnsatisfiedLinkError: no
jRegistryKey in java.library.path
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at CheckRegistry.<clinit>(CheckRegistry.java:61)
How to solve this please help me