如何在 Android 中使用 jess

How to use jess in Android

我正在尝试在 Android 项目中使用 JESS。我尝试使用 Jess 6,它在 netbeans 上的 Web 应用程序上运行良好,但出现错误。好像jar文件的版本不兼容。 我需要有关如何将 jess 与 Android 项目集成的帮助。

错误是由一行代码产生的:

Rete engine = new Rete();

查看下面的错误线索:

 2593-2593/com.example.modupe.tryjessapp E/AndroidRuntime: FATAL EXCEPTION: main
 Process: com.example.modupe.tryjessapp, PID: 2593
 java.lang.NoClassDefFoundError: Failed resolution of: Ljava/applet/Applet;
     at jess.Rete.getApplet(Unknown Source)
     at jess.Batch.batch(Unknown Source)
     at jess.Rete.if(Unknown Source)
     at jess.Rete.<init>(Unknown Source)
     at jess.Rete.<init>(Unknown Source)
     at jess.Rete.<init>(Unknown Source)
     at com.example.modupe.tryjessapp.MainActivity.<init>(MainActivity.java:17)
     at java.lang.Class.newInstance(Native Method)
     at android.app.Instrumentation.newActivity(Instrumentation.java:1078)
     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2557)
     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
     at android.app.ActivityThread.-wrap12(ActivityThread.java)
     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
     at android.os.Handler.dispatchMessage(Handler.java:102)
     at android.os.Looper.loop(Looper.java:154)
     at android.app.ActivityThread.main(ActivityThread.java:6119)
     at java.lang.reflect.Method.invoke(Native Method)
     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
  Caused by: java.lang.ClassNotFoundException: Didn't find class "java.applet.Applet" on path: DexPathList[[zip file "/data/app/com.example.modupe.tryjessapp-1/base.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.example.modupe.tryjessapp-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.example.modupe.tryjessapp-1/lib/x86, /system/lib, /vendor/lib]]
....

Jess 使用了许多 Java Dalvik 不支持的 API,Applet 是其中之一,但更重要的是,java.beans.Introspector。支持 android 的 Jess 版本仅作为 alpha 版本提供给源许可证持有者;尚未发布。