We build Android platform for an embedded product. Basically you can think of it as a rooted android box.
We have Java code that was developed for standard J2SE environment. I am porting it to Android. Part of the code was wrapped in an android service and launched in a service. There are parts that require it to run with super user privileges. Like opening files under /dev folder, binding to tcp ports below 1024 etc.
I am wondering if I can wrap this code in a J2SE style public Java class and invoke it using dalvik directly (i.e. something like “dalvik -classpath <paths to jars> mycompany.MyWrapper”).
I appreciate any links that describe a way to do this.
Thanks
You can invoke dalvik directly from the command line, and execute a class with the standard static main(String[] args) method.
dalvikvm -cp <jar_file> <class_name>For a full example, let’s say you have the following class definition in Hello.java
And then, to actually run it on a device: