digitalgust / miniJVM

Develop iOS Android app in java, Cross platform java virtual machine , the minimal jvm .
MIT License
328 stars 91 forks source link

[Question] Can jMonkeyEngine run with miniJVM? #7

Open Ali-RS opened 3 years ago

Ali-RS commented 3 years ago

Hi

Can jMonkeyEngine run on Android and iOS with miniJVM? If so can you please add a sample project with jMonkeyEngine and miniJVM?

Regards

digitalgust commented 3 years ago

minijvm using a compact runtime class library, so many third libs maybe unsupported

joliver82 commented 2 months ago

I confirm, I tried to run my jme3 game in linux using minijvm and it doesn't have all required classes (maybe there're some classes required by jme3 and other by my code)

Output:

[INFO]jvm inited
class not found:javax.imageio.ImageIO
method not exist :javax/imageio/ImageIO.read(Ljava/io/InputStream;)Ljava/awt/image/BufferedImage;
class not found:java.applet.Applet
class not found:java.applet.Applet
method not exist :java/applet/Applet.getAppletContext()Ljava/applet/AppletContext;
class not found:java.applet.AppletContext
method not exist :java/applet/AppletContext.getApplet(Ljava/lang/String;)Ljava/applet/Applet;
class not found:java.applet.Applet
method not exist :java/applet/Applet.getParameter(Ljava/lang/String;)Ljava/lang/String;
class not found:javax.swing.JOptionPane
method not exist :javax/swing/JOptionPane.showMessageDialog(Ljava/awt/Component;Ljava/lang/Object;Ljava/lang/String;I)V
class not found:java.lang.Thread$UncaughtExceptionHandler
class not found:java.util.concurrent.Callable
class not found:java.lang.management.ManagementFactory
method not exist :java/lang/management/ManagementFactory.getRuntimeMXBean()Ljava/lang/management/RuntimeMXBean;
class not found:java.lang.management.RuntimeMXBean
method not exist :java/lang/management/RuntimeMXBean.getInputArguments()Ljava/util/List;
class not found:java.util.concurrent.Callable
class not found:java.awt.Toolkit
method not exist :java/awt/Toolkit.getDefaultToolkit()Ljava/awt/Toolkit;
class not found:java.awt.Toolkit
method not exist :java/awt/Toolkit.getScreenSize()Ljava/awt/Dimension;
class not found:sun.misc.VM
method not exist :sun/misc/VM.maxDirectMemory()J
field not found java/util/logging/Level.OFF 
class not found:java.awt.Dimension
field not exist :java/awt/Dimension.widthI
field not found java/awt/Dimension.width 
class not found:java.awt.Dimension
field not exist :java/awt/Dimension.widthI
class not found:java.awt.Dimension
field not exist :java/awt/Dimension.heightI
field not found java/awt/Dimension.height 
class not found:java.awt.Dimension
field not exist :java/awt/Dimension.heightI
class not found:java.util.concurrent.Future
class not found:java.util.concurrent.Callable

[INFO]main thread start
[JDWP]jdwp listening (port:8000) ...
class not found:java.util.concurrent.ConcurrentHashMap
method not exist :java/util/concurrent/ConcurrentHashMap.<init>()V
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.get(Ljava/lang/Object;)Ljava/lang/Object;
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.values()Ljava/util/Collection;
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.containsKey(Ljava/lang/Object;)Z
class not found:java.util.concurrent.ConcurrentHashMap
[INFO]main thread over 27eb2c0 , return 1 , spent : 129
[INFO]jvm destoried

Also tested a basic jme3 app (the default project created from the SDK) and there's still some classes missing:

[INFO]jvm inited
class not found:java.util.concurrent.Future
class not found:java.util.concurrent.Callable

[INFO]main thread start
[JDWP]jdwp listening (port:8000) ...
class not found:java.util.concurrent.ConcurrentHashMap
method not exist :java/util/concurrent/ConcurrentHashMap.<init>()V
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.putIfAbsent(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.get(Ljava/lang/Object;)Ljava/lang/Object;
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.values()Ljava/util/Collection;
class not found:java.util.concurrent.ConcurrentMap
method not exist :java/util/concurrent/ConcurrentMap.containsKey(Ljava/lang/Object;)Z
class not found:java.util.concurrent.ConcurrentHashMap
[INFO]main thread over 1c40a10 , return 1 , spent : 463
[INFO]jvm destoried

I think it's weird because ConcurrentMap and ConcurrentHashMap exist in minijvm -> https://github.com/digitalgust/miniJVM/blob/master/minijvm/java/src/main/java/java/util/concurrent/ConcurrentMap.java https://github.com/digitalgust/miniJVM/blob/master/minijvm/java/src/main/java/java/util/concurrent/ConcurrentHashMap.java

digitalgust commented 2 months ago

minijvm has fewer than 500 system classes. To support the jme3 engine, a large number of library classes need to be added. In your code, you used ConcurrentHashMap, which exists, but due to the incomplete classes in the java.util.concurrent package, it may result in an error saying ConcurrentHashMap is not found. In the future, we can open a repository to add all the classes needed for jme3.