Advertisement
SrinjoySS01

Untitled

Mar 10th, 2021
379
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. #include "JVM.h"
  2. #define class(x) (*env)->FindClass(env, x)
  3. #define static_method(clazz, name, sign) (*env)->GetStaticMethodID(env, clazz, name, sign)
  4. #define non_static_method(clazz, name, sign) (*env)->GetMethodID(env, clazz, name, sign)
  5. #define exception if ((*env)->ExceptionCheck(env) == JNI_TRUE) (*env)->ExceptionDescribe(env)
  6.  
  7. int main(int argc, char* argv[]) {
  8.     JNIEnv *env = create_vm("../lib/jda.jar");
  9.     jclass JDABuilder = class("net/dv8tion/jda/api/JDABuilder");
  10.     jmethodID createDefault = static_method(JDABuilder, "createDefault", "(Ljava/lang/String;)Lnet/dv8tion/jda/api/JDABuilder;");
  11.     jobject jdabuilder = (*env)->CallStaticObjectMethod(env, JDABuilder, createDefault, argv[0]);
  12.     exception;
  13.     jmethodID build = non_static_method(JDABuilder, "build", "()Lnet/dv8tion/jda/api/JDA;");
  14.     jobject jda = (*env)->CallObjectMethod(env, jdabuilder, build);
  15.     exception;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement