SrinjoySS01

Untitled

Mar 10th, 2021
79
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "./include/libJNI.h"
  2. #define exception if ((*env)->ExceptionCheck(env) == JNI_TRUE) (*env)->ExceptionDescribe(env)
  3. #define class(x) (*env)->FindClass(env, x)
  4. #define static_method(clazz, name, sign) (*env)->GetStaticMethodID(env, clazz, name, sign)
  5. #define non_static_method(clazz, name, sign) (*env)->GetMethodID(env, clazz, name, sign)
  6. int main(int argc, char const *argv[]) {
  7.     JNIEnv* env = create_vm("/home/srinjoy/Desktop/programming related/JNIBot/lib/jda.jar");
  8.     jclass JDABuilder = class("net/dv8tion/jda/api/JDABuilder");
  9.     jmethodID createDefault = static_method(JDABuilder, "createDefault", "(Ljava/lang/String;)Lnet/dv8tion/jda/api/JDABuilder;");
  10.     jobject jdabuilder = (*env)->CallStaticObjectMethod(env, JDABuilder, createDefault, argv[0]);
  11.     exception;
  12.     jmethodID build = non_static_method(JDABuilder, "build", "()Lnet/dv8tion/jda/api/JDA;");
  13.     jobject jda = (*env)->CallObjectMethod(env, jdabuilder, build);
  14.     exception;
  15. }
RAW Paste Data