findClass
fun findClass(name: CValuesRef<ByteVar>): JClass?(source)
In JDK release 1.1, this function loads a locally defined class. It searches the directories and zip files specified by the CLASSPATH environment variable for the class with the specified name.
Since JDK 1.2, the Java security model allows non-system classes to load and call native methods. findClass locates the class loader associated with the current native method; that is, the class loader of the class that declared the native method. If the native method belongs to a system class, no class loader will be involved. Otherwise, the proper class loader will be invoked to load, link and initialize the named class.
Since JDK 1.2, when findClass is called through the Invocation Interface, there is no current native method or its associated class loader. In that case, the result of ClassLoader.getSystemClassLoader is used. This is the class loader the virtual machine creates for applications and is able to locate classes listed in the java.class.path property.
If findClass is called from a library lifecycle function hook, the class loader is determined as follows: for JNI_OnLoad and JNI_OnLoad_L the class loader of the class that is loading the native library is used for JNI_OnUnload and JNI_OnUnload_L the class loader returned by ClassLoader.getSystemClassLoader is used (as the class loader used at on-load time may no longer exist). The name argument is a fully qualified class name or an array type signature.
For example, the fully qualified class name for the java.lang.String class is "java/lang/String". The array type signature of the array class java.lang.Object[] is "[Ljava/lang/Object;".
See also: JNI_OnLoad, JNI_OnUnload
Return
a class object from a fully qualified name, or null if the class cannot be found.
Parameters
name of the class in the null-terminated modified UTF-8. Use String.modifiedUtf8 to get it, or if you are sure that your string doesn't have illegal characters you may use optimized String.utf8.
Throws
if the class data does not specify a valid class.
if a class or interface is its own superclass or superinterface.
if no definition for a requested class or interface can be found.
if the system runs out of memory.
inline fun findClass(name: String): JClass(source)
Alias for findClass which accepts the class name as a Kotlin String.
Throws instead of returning null if the class cannot be found.