Skip to content

Commit

Permalink
Use parent class loader when creating a new desktop classloader on cp…
Browse files Browse the repository at this point in the history
…p side
  • Loading branch information
piiertho committed Mar 11, 2021
1 parent f5e7b19 commit bfe8da4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/gd_kotlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ jni::JObject create_class_loader(jni::Env& env, const String& full_jar_path, con
jni::JClass url_cls = env.find_class("java/net/URL");
jni::JObjectArray urls = url_cls.new_object_array(env, 1, {url});
jni::JClass class_loader_cls = env.find_class("java/net/URLClassLoader");
jni::MethodId ctor = class_loader_cls.get_constructor_method_id(env, "([Ljava/net/URL;)V");
jvalue args[1] = {jni::to_jni_arg(urls)};
jni::MethodId ctor = class_loader_cls.get_constructor_method_id(
env,
"([Ljava/net/URL;Ljava/lang/ClassLoader;)V"
);
jvalue args[2] = {jni::to_jni_arg(urls), jni::to_jni_arg(p_parent_loader)};
jni::JObject class_loader = class_loader_cls.new_instance(env, ctor, args);
assert(!class_loader_cls.is_null());
return class_loader;
Expand Down

0 comments on commit bfe8da4

Please sign in to comment.