Need to run Java class with VM arguments. I am trying loadLibrary(thirt party DLL) from Java Application. For that I need to set java.library.path jvm arguement. I have tried following approach.
"C:\Program Files (x86)\Java\jdk1.8.0_92\bin\java" -Djava.library.path=C:\DLL TestMyProgram
I am running 32 bit DLL on 64 bit AMD platform thats why specifying full 32 bit jdk path in above command.
Here while running I am getting below exception
java.lang.UnsatisfiedLinkError: TestMyProgram.group(Ljava/lang/String;Z)Ljava/lang/String;
Not sure why java.library.path is not preperly set by first command. Any help is greatly appreciated.
Here is my program
public class TestMyProgram {
static
{
try {
System.loadLibrary("mydll");
} catch (UnsatisfiedLinkError e) {
System.out.println("Library not loaded" + e);
}
}
public static native String group(String msg, boolean isOracle);
public static void main(String args[]) {
StringBuffer sb = new StringBuffer();
sb.append("mymessage");
System.out.println("input \n : " + sb.toString());
String outStr = group(sb.toString(), false);
System.out.println(new Date());
System.out.println(outStr);
System.out.println(new Date());
}
}