summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 9ae4ff9)
raw | patch | inline | side by side (parent: 9ae4ff9)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 28 May 2009 10:10:42 +0000 (12:10 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Thu, 28 May 2009 10:10:42 +0000 (12:10 +0200) |
Thanks to Randy Rizun for pointing this out:
Hi!
just wanted to point out an issue in cjni_config_load_plugin
the call to FindClass passes the "Name" verbatim from the LoadPlugin directive
one might intuitively say LoadPlugin "com.foobar.Plugin"
whereas FindClass wants to see it as "com/foobar/Plugin"
so I guess either (a) document LoadPlugin to say to use slashes or (b)
subst / for . in cjni_config_load_plugin or (c) something else?!?
of course, everything works fine if my plugin is in the 'default' java
package (i.e., no package name) =)
either way, thanks a lot for the great work!!
-Randy
Hi!
just wanted to point out an issue in cjni_config_load_plugin
the call to FindClass passes the "Name" verbatim from the LoadPlugin directive
one might intuitively say LoadPlugin "com.foobar.Plugin"
whereas FindClass wants to see it as "com/foobar/Plugin"
so I guess either (a) document LoadPlugin to say to use slashes or (b)
subst / for . in cjni_config_load_plugin or (c) something else?!?
of course, everything works fine if my plugin is in the 'default' java
package (i.e., no package name) =)
either way, thanks a lot for the great work!!
-Randy
src/java.c | patch | blob | history |
diff --git a/src/java.c b/src/java.c
index c12cdfcea22ec37266a1c5f71c2ecb828a532899..6a98d82361435d5f2b6077c5c938617342483457 100644 (file)
--- a/src/java.c
+++ b/src/java.c
class->class = NULL;
class->object = NULL;
+ { /* Replace all dots ('.') with slashes ('/'). Dots are usually used
+ thorough the Java community, but (Sun's) `FindClass' and friends need
+ slashes. */
+ size_t i;
+ for (i = 0; class->name[i] != 0; i++)
+ if (class->name[i] == '.')
+ class->name[i] = '/';
+ }
+
DEBUG ("java plugin: Loading class %s", class->name);
class->class = (*jvm_env)->FindClass (jvm_env, class->name);