Did you put your .dlls into your */windows/system32* directory? Ali Ekber.
2010/12/1 Seyed Mahmood Hosseini <web....@gmail.com> > Hello > Using DLL in Java > I have a working sample program on how to use DLL in java with JNI. I > use to be properly implemented: > /* Test.java */ > public class Test { > /*Load the dll that exports functions callable from java*/ > static {System.loadLibrary("TestImp");} /* Name Of DLL : > TestImp.dll */ > /*Imported function declarations*/ > public native void print(String msg); > public native byte[] readFile(String path); > public native int searchFile(String path, byte[] b, int > bLength); > public native String[] findFiles(String path, String mask); > public native String[] checkProcess(String processName, boolean > killIt, boolean printOutput); > public native int startProcess(String commandLine, String > workingDir); > public native boolean waitForFileMask(String directrory, String > fileMask); > public native boolean waitForAnyFile(String directrory); > public void Test() { > } > public static void main(String [] args) { > Test t = new Test(); > /*Printf example*/ > t.print("->Testing JNI - Hello from \n"); > /*Loading a file as a byte array example*/ > System.out.println("->Start Open file Text.txt > \n" + new > String(t.readFile("Text.txt"))); > /*Printf example*/ > t.print("->Finish Sample \n"); > } > } > So you see that the package was not Test.java, these programs have > changed as follows: > (file path : C:\Tomcat5.5\webapps\ROOT\JNI\WEB-INF\classes\ver) > > > /* Test .java*/ > package ver; > public class Test { > /*Load the dll that exports functions callable from java*/ > static {System.loadLibrary("TestImp");} /* Name Of DLL : > TestImp.dll */ > /*Imported function declarations*/ > public native void print(String msg); > public native byte[] readFile(String path); > public native int searchFile(String path, byte[] b, int > bLength); > public native String[] findFiles(String path, String mask); > public native String[] checkProcess(String processName, boolean > killIt, boolean printOutput); > public native int startProcess(String commandLine, String > workingDir); > public native boolean waitForFileMask(String directrory, String > fileMask); > public native boolean waitForAnyFile(String directrory); > public void Test() { > } > } > And upper branches (file path : C:\Tomcat5.5\webapps\ROOT\JNI\WEB-INF > \classes) made the following file: > /*run.java*/ > import ver.*; > import java.io.*; > class usepackage{ > public static void main(String [] args) { > Test t = new Test (); > t.print(" JAVA "); > t.readFile("Text.txt"); > } > } > After the Test. Java & run.java compile and run the following command > and I got across the error: > C:\Tomcat5.5\webapps\ROOT\JNI\WEB-INF\classes >java run > Exception in thread "main" java.lang.UnsatisfiedLinkError: print > at ver.callmydll.print(Native Method) > at usepackage.main(usepackage.java:8) > How do you fix the error ??? > > -- > You received this message because you are subscribed to the Google > Groups "Java EE (J2EE) Programming with Passion!" group. > To post to this group, send email to > java-ee-j2ee-programming-with-passion@googlegroups.com > To unsubscribe from this group, send email to > java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com<java-ee-j2ee-programming-with-passion%2bunsubscr...@googlegroups.com> > For more options, visit this group at > > http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en -- Ali Ekber ÇELİK +905556129172 -- You received this message because you are subscribed to the Google Groups "Java EE (J2EE) Programming with Passion!" group. To post to this group, send email to java-ee-j2ee-programming-with-passion@googlegroups.com To unsubscribe from this group, send email to java-ee-j2ee-programming-with-passion+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/java-ee-j2ee-programming-with-passion?hl=en?hl=en