I am trying to access dll methods in java that was written in C #. From the following code, I am trying to create a dll that is generated successfully.
using System; using Microsoft.Win32; namespace CyberoamWinHelper { public class RegistryAccess { public static String getValue(String key) { RegistryKey rk = Registry.CurrentUser; RegistryKey rk1=rk.OpenSubKey("Software\\Test", RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl); rk1.SetValue(key, "val1"); return rk1.GetValue(key).ToString(); } public static void createSubkey(String name) { RegistryKey rk = Registry.CurrentUser; rk.CreateSubKey("Software\\Test"); } } }
After that, I load the generated dll into my java program code, which looks like this
public class JNI { public native String getValue(String key); public static void main(String[] args) {
After running this code, it causes the following error.
"Exjni.JNI.getValue(Ljava/lang/String;)Ljava/lang/String;"
Well, I donโt understand what this error says, but I want to solve it. And another question that I have is that the method I'm calling is a static method, will it be called this way? I want to call the static method we need
"classname.methodname"
So he can call the method?
source share