I want to create registry key through java program to add the jar file in the start up.
RegistryKey r=new RegistryKey(RootKey.HKEY_CURRENT_USER,"Software/Microsoft/Windows/CurrentVersion/Run");
r.createSubkey("sample");
But i got the error:
Exception in thread "main" java.lang.UnsatisfiedLinkError: ca.beq.util.win32.registry.RegistryKey.testInitialized()V
at ca.beq.util.win32.registry.RegistryKey.testInitialized(Native Method)
How can i do that?
Thanks
From the Javadoc:
Thrown if the Java Virtual Machine cannot find an appropriate native-language definition of a method declared native.
You wouldn't be on a win 64 OS by any chance?
If not, the manual for jreg mentions:
jRegistryKeyis aJNIlibrary. To usejRegistryKey, the following files are required:
jRegistryKey.jarjRegistryKey.dlljRegistryKey.jar is the Java™ Archive (JAR) file containing the packaged Java™ class files, whereas jRegistryKey.dll is a Windows® dyanmically linked library (DLL) that contains the native (C/C++) code required to access the registry.
jRegistryKey.jarmust be included in theCLASSPATHavailable to the Java™ Virtual Machine (JVM);
jRegistryKey.dllmust be located in a directory included in the Windows® PATH environment variable orjava.lang.UnsatisfiedLinkError's will be generated
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With