TML Messaging Suite  1.1.5
for Java
 All Classes Namespaces Functions Variables Groups Pages
Install libTML-java from source

The libTML-java library is intended to be used on multiple platforms. CMake is used to simplify building, installing or creating project files for a preferred development environment and platform. All instructions in this section require to install CMake. You can download CMake here: http://www.cmake.org/download/

All instructions require the sources of the libTML-java library from GitHub. Download the ZIP archive and extract the files on your target or build system.

Currently the following target systems are tested:



Library dependencies

To build libTML-java various libraries need to be present. Refer to the documentation of the particular library for installation.

libTML-c

See Installation guide for libTML-c.

Set library dependencies manually

By default cmake finds the library and include paths automatically. If the libraries are not installed in the default location, the CMakeLists.txt in the root directory of libTML-java has to be modified. These modifications are usually necessary on Windows. Find the intended build target in the CMakeLists.txt file and modify the directories.

Set include directories:

set(JNIINCLUDE "C:\\Program Files\\Java\\jdk1.7.0_71\\include")
set(JNIINCLUDE_PLATFORM "C:\\Program Files\\Java\\jdk1.7.0_71\\include\\win32")
set(TMLINCLUDE "X:\\workdir\\libtml-c\\sidex\\src"
               "X:\\workdir\\libtml-c\\common\\src"
               "X:\\workdir\\libtml-c\\tml\\src")

Set library directories:

LINK_DIRECTORIES("X:\\workdir\\libtml-c\\build\\win_x86-32\\sidex\\Release"
                 "X:\\workdir\\libtml-c\\build\\win_x86-32\\tml\\Release")



Build libTML-java on Windows

To build libTML-java on Windows either Visual Studio or MinGW can be uses.

Build with MinGW

The compiled libraries require the MinGW run time libraries.

Download the MinGW Installer from http://www.mingw.org/. After installation start the guimain.exe and mark the required packages:

win32

Apply changes to install the packages. Open the MSys console (<MinGW Installdir>\msys\1.0\msys.bat) and go to libtml-java/src of the libTML-java files.

win64

To compile 64 bit libraries with MinGW a 64 bit compiler is required. After installing MinGW for 32 bit you need to download the 64 bit MinGW package from **here** Extract the package but do not overwrite the previous 32 bit MinGW installation.

Use the win_mingw64.cmake tool chain to set the compiler path for win64 binary build. (see Build libTML-java win64 with MinGW)



Build libTML-java win32 with MinGW

To build libTML-java win32 binaries on Windows with MinGW, the settings for the tool chain have to be adjusted. CMake needs the information where to find win32 compiler. Edit the tool chain file win_mingw32.cmake. The file is located in libtml-java/src.

The CMake cache file CMakeCache.txt is storing parameters from a previous build. If you create the binaries for a different platform you need to delete CMakeCache.txt and the CMakeFiles directory in order to create a clean new set of project files.

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


Build libTML-java win64 with MinGW

To build libTML-java win64 binaries on Windows with MinGW, the settings for the tool chain have to be adjusted. CMake needs the information where to find win64 compiler. Edit the tool chain file win_mingw64.cmake. The file is located in libtml-java/src.

The CMake cache file CMakeCache.txt is storing parameters from a previous build. If you create the binaries for a different platform you need to delete CMakeCache.txt and the CMakeFiles directory in order to create a clean new set of project files.

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


Build libTML-java on Windows with Visual Studio

The CMake cache file CMakeCache.txt is storing parameters from a previous build. If you create the binaries for a different platform you need to delete CMakeCache.txt and the CMakeFiles directory in order to create a clean new set of project files.

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


Build libTML-java on LINUX x86

The CMake cache file CMakeCache.txt is storing parameters from a previous build. If you create the binaries for a different platform you need to delete CMakeCache.txt and the CMakeFiles directory in order to create a clean new set of project files.

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


Build libTML-java on OS X

The CMake cache file CMakeCache.txt is storing parameters from a previous build. If you create the binaries for a different platform you need to delete CMakeCache.txt and the CMakeFiles directory in order to create a clean new set of project files.

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


Build libTML-java on LINUX ARM

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


libTML-java cross build for Android

To build libTML-java for Android with CMAKE, the settings for the tool chain have to be adjusted. CMake needs the information where to find the Android cross compiler. Edit the tool chain file android_arm32.cmake. The file is located in libtml-java/src.

The Android NDK is required for cross compilation. Depending on the intended target platform you need to download and install the matching version. The Android NDK can be downloaded from https://developer.android.com/ndk/downloads.

>The required libraries have to be build as well. Some of the libraries do not include instructions on how to build on Android. The 3rdParty directory of the libTML-c source distribution contains additional files and instructions inAndroidBuild-ReadMe.md to fill this gap. Depending on the version of the library additional modifications may be required.

A cross compile for Android on Windows requires MinGW with the MSYS packages.

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


Build libTML-java on freeBSD x86

The CMake cache file CMakeCache.txt is storing parameters from a previous build. If you create the binaries for different platform you need to delete CMakeCache.txt and the CMakeFiles directory in order to create a clean new set of project files.

Continue reading chapter "JNI" of this documentation, building the Java archive (JAR).


JNI

The Java Native Interface consists of a "Java part" and a "C part":

The libTML-java build description above leads to the "C part" of the JNI (native libraries):

The "java Part" of the JNI has to be build explicitly out of our JNI Java source files using the Java Development Kit (JDK).

The JNI source files

You find the JNI Java sources in the subfolder "/java" of the libTML-java source repository.

creating a JAR

Running a Java program using package of Java classes it is usual to bind them into a Java archive (JAR). If you don't already have a JDK, download and install it appropriately. Keep your platform (x86 or x64) in mind.

The following description is a way on how to build a Java Archive (JAR) out of our JNI Java sources.

Example on linux and OS-X platforms:

mkdir class
find . -name "*.java" > targetList.txt
javac -cp class -d class @targetList.txt
cd class
jar cf tmlSidex.jar com

Example on windows:

mkdir class
dir /s /B *.java > targetList.txt
javac -cp class -d class @targetList.txt
cd class
jar cf tmlSidex.jar com

If the pathname contains blanks, you have to edit the text file targetList.txt, set each line lines into quotes and replace backslashes to slashes before using the javac compiler.

Please read the documentation Introduction to libTML-java to get information of how to use the library.