Explicitly load tdjni in Client.java and TdApi.java.

This commit is contained in:
levlam 2022-09-08 14:27:07 +03:00
parent 612afe63fe
commit 4d5625a06f
3 changed files with 17 additions and 9 deletions

View File

@ -13,6 +13,14 @@ import java.util.concurrent.atomic.AtomicLong;
* Main class for interaction with the TDLib.
*/
public final class Client {
static {
try {
System.loadLibrary("tdjni");
} catch (UnsatisfiedLinkError e) {
e.printStackTrace();
}
}
/**
* Interface for handler for results of queries to TDLib and incoming updates from TDLib.
*/

View File

@ -55,14 +55,6 @@ public final class Example {
private static final String commandsLine = "Enter command (gcs - GetChats, gc <chatId> - GetChat, me - GetMe, sm <chatId> <message> - SendMessage, lo - LogOut, q - Quit): ";
private static volatile String currentPrompt = null;
static {
try {
System.loadLibrary("tdjni");
} catch (UnsatisfiedLinkError e) {
e.printStackTrace();
}
}
private static void print(String str) {
if (currentPrompt != null) {
System.out.println("");

View File

@ -194,7 +194,15 @@ std::string TD_TL_writer_java::gen_output_begin() const {
return "package " + package_name +
";\n\n"
"public class " +
tl_name + " {\n";
tl_name +
" {\n"
" static {\n"
" try {\n"
" System.loadLibrary(\"tdjni\");\n"
" } catch (UnsatisfiedLinkError e) {\n"
" e.printStackTrace();\n" +
" }\n"
" }\n\n";
}
std::string TD_TL_writer_java::gen_output_end() const {