javaandroidjar

Running an executable jar in android


is it possible to run an executable jar file (command line based) in android? one of my friend told me that it is possible to run executables written in C. Is it possible for java too? I will run the tool through adb shell.


Solution

  • You can install an app built as an APK through adb:

    adb install my_apk_file.apk
    

    And once inside an adb shell, you can launch an APK application using the am command. See How to start an application using android ADB tools?

    But I don't think there's a way to directly run a jar file the way you can do so on a desktop operating system, because Android doesn't use the standard Java VM.

    I think you would need to embed your .jar file inside a minimal Android application that invokes the jar and prints results to stdout. Then you would build that APK and install/run it as I described above.