2020-11-16 10:01:40
I can run java code via termux in my device (pie) with dalvikvm.
Few guys claims dalvikvm can't execute code in android pie but look like that's not true for all devices.
Here are the steps to checkout.
Requirements: dx , ecj
#1. Save this code into hello.java
class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World!"); } }
#2 Now compile it via ecj.
ecj hello.java
It will output a file, HelloWorld.class
#3 Now generate dex file.
dx --dex --output=Main.dex HelloWorld.class
#4 Now execute your java bytecode with android java virtual machine.
dalvikvm -cp Main.dex HelloWorld
Output:
Hello world!Here if you get any error, report here with your device info
568 viewskcubeterm, edited 07:01