I am trying to use Telegram Database Library (TDLib) to create my own web client for Telegram using Spring-boot and IntelliJ. Using the following documentation I was able to build and run the Example.java on my linux terminal:
TDLib Documentation : https://core.telegram.org/tdlib
TDLib GitHub : https://github.com/tdlib/td/
TDLib Java Example GitHub : https://github.com/tdlib/td/tree/master/example/java
TDLib GitHub Java Example build instructions : https://tdlib.github.io/td/build.html?language=Java
CONFIGURATION:
Choose a programming language from which you want to use TDLib: JAVA
Choose an operating system on which you want to use TDLib: Linux
Choose a Linux distro on which you want to use TDLib: Ubuntu 20
INSTRUCTIONS:
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install make git zlib1g-dev libssl-dev gperf php-cli
cmake default-jdk g++
git clone https://github.com/tdlib/td.git
cd td
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../example/java/td -DTD_ENABLE_JNI=ON ..
cmake --build . --target install
cd ..
cd example/java
rm -rf build
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=../../../tdlib -DTd_DIR:PATH=$(readlink -e ../td/lib/cmake/Td) ..
cmake --build . --target install
cd ../../..
cd ..
ls -l td/tdlib
Using the given below Stackoverflow post I tried running the downloaded td-library to import and build the project in IntelliJ for Java : How to import and build TDLib project in Intellij for Java language and fix dll problems?
I am getting the following error on IntelliJ while running Example.java:
ERROR:
/home/yashdeepsingh/.jdks/jbrsdk-17.0.9/bin/java -javaagent:/snap/intellij-idea-community/473/lib/idea_rt.jar=39397:/snap/intellij-idea-community/473/bin -Dfile.encoding=UTF-8 -classpath /home/yashdeepsingh/PROJECT/td/out/production/td org.drinkless.tdlib.example.Example
java.lang.UnsatisfiedLinkError: no tdjni in java.library.path: /usr/java/packages/lib:/usr/lib64:/lib64:/lib:/usr/lib
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2434)
at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:818)
at java.base/java.lang.System.loadLibrary(System.java:1989)
at org.drinkless.tdlib.Client.<clinit>(Client.java:18)
at org.drinkless.tdlib.example.Example.main(Example.java:302)
Exception in thread "main" java.lang.UnsatisfiedLinkError: 'void org.drinkless.tdlib.Client.nativeClientSetLogMessageHandler(int, org.drinkless.tdlib.Client$LogMessageHandler)'
at org.drinkless.tdlib.Client.nativeClientSetLogMessageHandler(Native Method)
at org.drinkless.tdlib.Client.setLogMessageHandler(Client.java:161)
at org.drinkless.tdlib.example.Example.main(Example.java:302)
Process finished with exit code 1
I want to use the TDLib java code to further develop my own client in a different Springboot project.
How should I proceed next? Any help regarding this would be greatly appreciated.
after building the files by following the build instructions mentioned herehttps://github.com/tdlib/td/tree/master/example/java
also to build you need to install cmake prior
then it will generate some build files like below
then you can copy all those build files to the td\example\java folder
then set vm arguments like below
now you can run the example class
would be happy to share more details if still facing issues