NOTE: This functionality is EXPERIMENTAL and is not officially supported by LEADTOOLS. This is more of a proof of concept and can help those who want this functionality.
This example was created using LEADTOOLS 14.5, Java 1.5 Update 9 with NETBEANS IDE, JNI (Java Native Interface), and Microsoft VC++ 6.0 and shows how to call the L_FileConvert function from Java. You should already be familiar with programming in Java, C++, and the LEADTOOLS API.
Attached are all the necessary files for creating this project, any directories or files referenced are included in the attached .zip file.. The basic steps for calling a LEADTOOLS API function are:
1.) Write
a simple Java class. All that is necessary is a load of the DLL (made in step 7), a wrapper native function, and a main() to run and test the functions. This java file is included in the zip file under the src\ directory.
2.) Create a C/C++ header file from the class created from step 1 using javah.exe and the -jni argument. The full command would look like this: "javah -jni LEADFromJava"
3.) Create
a new DLL project (I used MFC AppWizard in MSVC6). This is included in the C++ Part\ directory.
4.) Add
the JNI header file (created from javah) to your C++ project.
5.) Include
the JNI header file and any necessary LEADTOOLS header files. Make sure your project settings have the
proper Include and Library directories as well as any LEADTOOLS .lib files.
6.) Add
the function(s) defined in the JNI header into the main header file and
add types to the parameters.
7.) Build
the DLL and place it into your System32 directory (or wherever your System.load() from Java is pointing to).
8.) Run
your Java Application.
Here are some other good resources on using the JNI:
http://java.sun.com/j2se...ocs/guide/jni/index.htmlhttp://en.wikipedia.org/wiki/Java_Native_InterfaceEdited by moderator Tuesday, October 18, 2016 11:41:10 AM(UTC)
| Reason: Not specified