Answer the question
In order to leave comments, you need to log in
Why is findclass not finding classes?
There is a desktop application written in Java which consists of: main.jar, app.jar, lib1.jar, lib2.jar...
The application starts from main.jar and loads app.jar (the application itself and its functionality) and additional libraries. The app.jar is loaded like this
Class<?> clasz = classLoader.loadClass("some.class.to.load.from.app.jar");
jsize count;
if ( JNI_GetCreatedJavaVMs( &mc->m_jvm, 1, &count ) != JNI_OK || count == 0 ) {
return;
}
jint res = mc->m_jvm->GetEnv( ( void ** ) &mc->m_jenv, JNI_VERSION_1_6 );
if ( res == JNI_EDETACHED ) {
res = mc->m_jvm->AttachCurrentThread( ( void ** ) &mc->m_jenv, nullptr );
}
if ( res != JNI_OK ) {
return;
}
jclass classs = mc->m_jenv->FindClass("some/class/from/main/jar");
jclass classs = mc->m_jenv->FindClass("some/class/from/app/jar");
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question