feat.新增 java sample (但好像还不能用)

This commit is contained in:
MistEO
2022-02-22 00:38:32 +08:00
parent 18217f4bed
commit 5257ee212f
4 changed files with 24 additions and 2 deletions

2
src/Java/.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*.class
*.jar

View File

@@ -0,0 +1,12 @@
package com.meo.asst;
public class libmaa {
static {
// System.loadLibrary("MeoAssistant");
System.loadLibrary("MeoAssistantJni");
}
public static native long create(String dirname);
public static native void destroy(long handle);
}

View File

@@ -23,7 +23,7 @@
extern "C" {
#endif
JNIEXPORT jlong JNICALL Java_com_maa_create(JNIEnv* env, jclass c, jstring jstr_dirname)
JNIEXPORT jlong JNICALL Java_com_meo_asst_libmaa_create(JNIEnv* env, jclass c, jstring jstr_dirname)
{
LOG_D(__FUNCTION__);
@@ -46,7 +46,7 @@ extern "C" {
return (jlong)p_asst;
}
JNIEXPORT void JNICALL Java_com_maa_destroy(JNIEnv* env, jclass c, jlong jlong_asst)
JNIEXPORT void JNICALL Java_com_meo_asst_libmaa_destroy(JNIEnv* env, jclass c, jlong jlong_asst)
{
LOG_D(__FUNCTION__);

8
src/Java/sample.java Normal file
View File

@@ -0,0 +1,8 @@
import com.meo.asst.libmaa;
public class sample {
public static void main(String[] args) {
long handle = libmaa.create("D:\\Code\\MeoAssistantArknights\\x64\\Release");
libmaa.destroy(handle);
}
}