简体   繁体   English

android-如何在adb shell中运行java hello world程序?

[英]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: 我可以使用android am / pm程序采用的方法:

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. 我认为使用dx / dvz / dalvikvm必须有一种更简单的方法。

It would be much easier if you used eclipse to wrap all those commands. 如果您使用eclipse来包装所有这些命令,将会容易得多。 ADT plugin for eclipse is just great and productive. eclipse的ADT插件非常棒且高效。

Assuming you do mean a Java hello world, and not an Android hello world: 假设您的意思是Java hello世界,而不是Android hello世界:

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. Terminal IDE是市场上的一个应用程序,它使您可以在设备上执行此操作,或远程登录到设备中,然后再使用它们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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