简体   繁体   中英

android - how to run java hello world program in adb shell?

It would be better if detailed commands provided. Thanks!

I can use the method adopted by android am/pm program:

1. create Android.mk and java file
2. compile using mmm
3. put the generated jar to target /data/
4. run it:
# export CLASS_PATH=/data/MyTest.jar
# app_process /data com.android.test.MyTest

It work, but somewhat difficult. I think there must be an easier way using dx/dvz/dalvikvm.

It would be much easier if you used eclipse to wrap all those commands. ADT plugin for eclipse is just great and productive.

Assuming you do mean a Java hello world, and not an Android hello world:

javac Hello.java
dx --dex --no-strict --output=Hello.jar Hello.class
java -jar Hello.jar Hello

Terminal IDE, an app on the market, allows you to do this on the device, or to telnet into the device and then make use of them.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM