Here is my situation. I am using a custom programming language thats syntax is based on Java. In order to compile this *.custom file I use the java classpath to locate the .jar that contains the .class files. This converts the .custom to .java from there I compile down to Java Byte Code and run on JVM. Now I am looking to use this custom language on Android. Is there a way that I can incorporate a .custom file into android and compile into .java and then to Dalvik Byte Code to run? Looking for any suggestions to run .custom on Android Thanks
2 Answers
The Android dev tools are ultimately operating on Java .class files. If you can compile your code into something that will run on the JVM with the class-library restrictions of Android, you can compile the .class into a .dex. Keep in mind that you'll need to be referring to the Android API in your programs so the Android installer can link them to the Android runtime.
2 Comments
user2757520
So if I compile into the class files and then convert to dex and run on Android it should ideally work? My question is how would I initiate the main() in the class file from the onCreate?
chrylis -cautiouslyoptimistic-
You would have to use the same lifecycle as anything else in Android; you use the manifest and Android entry points, not CLI Java
main.You can either compile to .class and then convert that to .dex using the dx tool. Or you can use DexMaker to go right to .dex from source.
2 Comments
user2757520
Ok, i was able to successfully convert a "HelloWorld" function from .custom to dex. Now how do i go about loading the dex file in a android app?
fadden
Search for
DexClassLoader.
.classfiles. If you can compile your code into something that will run on the JVM with the class-library restrictions of Android, you can compile the.classinto a.dex. Keep in mind that you'll need to be referring to the Android API in your programs so the Android installer can link them to the Android runtime.