C++のjarにラッパーを記述する必要があります。私は1つのPOCを行い、すべてのクラスを見つけることができましたが、特定のjarではnullptrを取得しています。JNIを使用してC++のjarから特定のクラスにアクセスできません
jclass keyCloakTestClass = env-
>FindClass("com/test/main/KeycloakAdapterProperties");
if(keyCloakTestClass == nullptr)
{
cerr << "ERROR: class not found !";
}
nullptrとしてjclassオブジェクトが取得されています。
KeycloakAdapterPropertiesクラスのコードスニペットは次のとおりです。
package com.test.main;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLClassLoader;
import java.util.Properties;
public final class KeycloakAdapterProperties
{
private KeycloakAdapterProperties()
{
throw new InstantiationError("no instance creation allowed");
}
}
これはJARの作成に関係するものですか?
nullptrを取得している理由を入力してください。
クラスcom/siemens/vicos/cbtc/main/KeyCloakTestを探していますが、実際にはあなたのクラスはcom/test/main/KeycloakAdapterProperties – mko
です。投稿を編集しました。編集したコードスニペットで入力内容を共有してください。 – kunal