Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "JVM.h"
- #define class(x) (*env)->FindClass(env, x)
- #define static_method(clazz, name, sign) (*env)->GetStaticMethodID(env, clazz, name, sign)
- #define non_static_method(clazz, name, sign) (*env)->GetMethodID(env, clazz, name, sign)
- #define exception if ((*env)->ExceptionCheck(env) == JNI_TRUE) (*env)->ExceptionDescribe(env)
- int main(int argc, char* argv[]) {
- JNIEnv *env = create_vm("../lib/jda.jar");
- jclass JDABuilder = class("net/dv8tion/jda/api/JDABuilder");
- jmethodID createDefault = static_method(JDABuilder, "createDefault", "(Ljava/lang/String;)Lnet/dv8tion/jda/api/JDABuilder;");
- jobject jdabuilder = (*env)->CallStaticObjectMethod(env, JDABuilder, createDefault, argv[0]);
- exception;
- jmethodID build = non_static_method(JDABuilder, "build", "()Lnet/dv8tion/jda/api/JDA;");
- jobject jda = (*env)->CallObjectMethod(env, jdabuilder, build);
- exception;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement