How can I compile a java file on my Android Emulat

2019-07-12 04:40发布

问题:

I have a java file on my android emulator and I need to compile it on the emulator terminal. Whenever I write "javac filename.java" I get an error message saying: "Permission denied".

回答1:

You can not do this. When you compile a java source file it is first complied into a .class file which is Java byte code. After that the class files are then compiled again into a .dex file which is the Dalvik byte code which the Dalvik virtual machine can run. This .dex file is then compressed into an .apk file which is the archive which contain all your application's data. You can read more about it here.



回答2:

I'd start by looking at Terminal IDE, although on the emulator, I can't imagine it will be much fun.

In theory, it should work, if slowly. It's java/javac/apkbuilder/etc. with vim, and doesn't require rooting.