简体   繁体   English

子类的JNI FindClass格式?

[英]JNI FindClass format for subclasses?

What is the correct FindClass identifier syntax to load subclasses? 加载子类的正确FindClass标识语法是什么? For example: 例如:

package a.b.c;

class Foo {
   class Bar {
     ...
   }
}

To get Foo I can do (*env)->FindClass(env, "/a/b/c/Foo") , but trying to get Bar through (*env)->FindClass(env, "a/b/c/Foo/Bar") throws a ClassNotFoundException . 为了得到Foo我可以做(*env)->FindClass(env, "/a/b/c/Foo")而是试图让Bar通过(*env)->FindClass(env, "a/b/c/Foo/Bar")抛出ClassNotFoundException Is there a different syntax for representing subclasses? 是否有不同的语法来表示子类?

Never mind, the javap tool proved helpful here. 没关系, javap工具在这里证明是有用的。 The correct syntax is: 正确的语法是:

a/b/c/Foo$Bar

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM