I know what you’re thinking…”That’s a horrible idea and you’re a horrible person for suggesting it!”
The main problems with Java on DS:
1. Interpreted languages are slower, the overhead is bad on a slower embedded platform
2. No direct memory access. Almost all of the DS hardware is interfaced by reading and writing directly to specific memory locations
3. No primitive unsigned 8-bit types. What were they thinking?
But…I went ahead and did it anyway, just for fun. I didn’t start from scratch, I took Torlus’s KVM port to GBA and used that as a base for getting it to work on DS. Right now, when it starts, you pick a .class file, and it will run it! In addition, using KNI, I’ve written a basic wrapper around parts of libnds, enough to read input from the touchscreen/buttons, and to move sprites around.
Download here: java4nds_r2.zip — includes the compiled KVM.nds, some examples along with source code, and instructions on making your own .java files.
To use this demo, place kvm.nds, all the *.class files, and all the *.bin files on the root of your flashcart.
Run kvm.nds, then select a .class file to run. There are a few examples testing various stuff.
Don’t forget to DLDI-patch the kvm.nds