LEADTOOLS Support
General
LEADTOOLS SDK Examples
HOWTO: Call a LEADTOOLS API Function from Java
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, October 12, 2006 11:58:25 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 764
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
#2
Posted
:
Thursday, February 12, 2009 5:11:51 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 764
Attached is an updated version of this project using Java 1.6 update 11 and LEADTOOLS v16.
#3
Posted
:
Friday, February 6, 2015 1:03:40 PM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Update for v19 Java 8 32 bit
Unzip, compile the c++ part, make sure your Java is set for 32 bit and run.
Note: make sure Syswow64 and bin/CDLLVC10/win32 are in your path
#4
Posted
:
Tuesday, June 14, 2016 5:02:11 AM(UTC)
Groups: Manager, Tech Support, Administrators
Posts: 218
Was thanked: 12 time(s) in 12 post(s)
LEADTOOLS now has Java libraries!
You can read more about the current LEADTOOLS Java offering here:
https://www.leadtools.com/sdk/javaEdited by moderator Thursday, September 22, 2016 1:27:43 PM(UTC)
| Reason: Not specified
Hadi Chami
Developer Support Manager
LEAD Technologies, Inc.


1 user thanked Hadi for this useful post.
LEADTOOLS Support
General
LEADTOOLS SDK Examples
HOWTO: Call a LEADTOOLS API Function from Java
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.