From e1ec72eab6d00b3ba38e5932bc88920f103b6e4a Mon Sep 17 00:00:00 2001 From: aunsane Date: Fri, 27 Apr 2018 21:33:17 +0300 Subject: Telegram: initial commit - tdlib moved to telegram dir --- protocols/Telegram/tdlib/td/example/java/README.md | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 protocols/Telegram/tdlib/td/example/java/README.md (limited to 'protocols/Telegram/tdlib/td/example/java/README.md') diff --git a/protocols/Telegram/tdlib/td/example/java/README.md b/protocols/Telegram/tdlib/td/example/java/README.md new file mode 100644 index 0000000000..c2b5c43171 --- /dev/null +++ b/protocols/Telegram/tdlib/td/example/java/README.md @@ -0,0 +1,39 @@ +# TDLib Java example + +To run this example, you will need installed JDK >= 1.6. +For Javadoc documentation generation PHP is needed. + +TDLib should be prebuilt for using with Java and installed to local subdirectory `td/` as follows: +``` +cd +mkdir jnibuild +cd jnibuild +cmake -DCMAKE_BUILD_TYPE=Release -DTD_ENABLE_JNI=ON -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td .. +cmake --build . --target install +``` +If you want to compile TDLib for 64-bit Java on Windows using MSVC, you will also need to add `-A x64` option to CMake. + +In Windows, use Vcpkg toolchain file by adding parameter -DCMAKE_TOOLCHAIN_FILE=/scripts/buildsystems/vcpkg.cmake + +Then you can build this example: +``` +cd /example/java +mkdir build +cd build +cmake -DCMAKE_BUILD_TYPE=Release -DTd_DIR=/example/java/td/lib/cmake/Td -DCMAKE_INSTALL_PREFIX:PATH=.. .. +cmake --build . --target install +``` + +Compiled TDLib shared library and Java example after that will be placed in bin/ and Javadoc documentation in `docs/`. + +Now you can run Java example: +``` +cd /example/java/bin +java '-Djava.library.path=.' org/drinkless/tdlib/example/Example +``` + +If you get "Could NOT find JNI ..." error from CMake, you need to specify to CMake path to the installed JDK, for example, "-DJAVA_HOME=/usr/lib/jvm/java-8-oracle/". + +If you get java.lang.UnsatisfiedLinkError with "Can't find dependent libraries", you may also need to copy some dependent shared libraries to `bin/`. + +In case you compiled the example as 32-bit version, you may need to give -d32 parameter to Java. -- cgit v1.2.3