pengguang001
pengguang001

Reputation: 4205

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.

Upvotes: 0

Views: 5171

Answers (2)

Julian Fondren
Julian Fondren

Reputation: 5619

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.

Upvotes: 1

Snicolas
Snicolas

Reputation: 38168

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

Upvotes: 1

Related Questions