Reputation: 8805
I see tutorials that show you how to make a real android application with activities and all that, but all I really want to do is make a java class that has a public void static main(String params[]) { System.out.println("Hello World");} and run it with java HelloWorld on an android machine. Is that possible?
Upvotes: 4
Views: 2834
Reputation: 160
Actually, if you take the time to create a very simple Activity (which Eclipse will basically generate for you when you make a new Android application, then you will be able to create and call any class or method on that class that you so desire.
In the Activity class, there will be a method called create() - you will modify it to instantiate your class and call a desired method...
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Instantiate your class or simply call its main(String[] args) method here
}
There, that wasn't so hard was it?
Good Luck!
Rodney
Upvotes: 2
Reputation: 5022
There's a great app on the Android market called Terminal IDE that includes a great shell environment, vim/nano and java/javac all compiled to run natively on Android. With this you can run "normal" Java code.
Upvotes: 8