I have created an android project in Eclipse indigo 3.7.2. The project runs successfully. Now I have added a new java class file called test.java with the following contents
public class test
{
public static void main(String[] args)
{
System.out.println("Hello World");
}
}
Please tell me how to run this file android emulator
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.
Source How can I compile a java file on my Android Emulator? . Originally answered by Stefan Bossbaly.