1

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
  • 1
    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. Commented Sep 7, 2013 at 18:10
  • @Chrylis that should be an answer. Commented Sep 7, 2013 at 19:05

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

2 Comments

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?
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.
0

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

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?
Search for DexClassLoader.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.