How to import and build TDLib project in Intellij for Java language and fix dll problems?

362 Views Asked by At

I would like to import TDLib project in Intellij and build it using Java language but the documentation is not well written. Any help appreciated.

1

There are 1 best solutions below

0
On

Here is my step by step guide how you can build TDLib project following the bellow steps which took me a couple of hours to do it.

First go to this address and select your language which here is Java and Operating system and so on.

enter image description here

Then you will see a list of commands which you have to run them one by one or copy all of them and paste them in windows Powershell.

enter image description here

After executing commands it will download neccessary files and will build the project.

Your project tab in intellij will look like this:

enter image description here

In this step you have finished building TDlib project.

The second step is to solve size problem for TdApi.java file:

 File size exceeds configured limit (2560000), code insight features not available

Solution: In Intellij Go to Menu Help > Edit Custom Properties and add this line:

idea.max.intellisense.filesize=25000

At this step you shouldn't have compile time error. Go to this path and run the project example/java/org/drinkless/tdlib/example/Example.java.

I was facing bellow runtime error:

TDLib UnsatisfiedLinkError (no tdjni in java.library.path)

For fixing this problem I just copied all the .dll files inside D:\~\td\tdlib\bin folder to D:\~\td\example\java\td\bin folder.

Another error I faced after running the project again was the bellow one:

tdjni.dll: Can't find dependent libraries

Which I could fix it by copying all the .dll files inside this folder D:\~\td\example\java\td\bin to C:\Windows\System32 folder.

Then I could run the project successfully.

Hope this become helpful and save your time a bit.