Robots w/Lasers

August 8, 2007

Java for NDS?

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: — 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

Filed under: Java,Nintendo DS,Software — davr @ 8:36 am


  1. Hello,

    I’ not a computer/NDS expert :-(, so this discussion is hard to understand. I’got a Kanji programm as a Jar file and a file for Palm OS. Is it possible to dezipp the Jar and run it on Java4nds or is it easier to emulate Palm OS-based PRC file (is there even a “Palm4nds” programm)??? I’m sorry, but I just start to leave the mainstream NDS and would like to have a “NDS for dummies”.
    Thank you very much 🙂

    Comment by nekonetsuke — January 6, 2009 @ 1:58 pm

  2. That’s a horrible idea and you’re a horrible person for suggesting it!

    Comment by THE ANONYMOUS SAGE — March 5, 2009 @ 11:19 pm

  3. Is this going anywhere?

    Comment by jo — March 27, 2009 @ 2:53 pm

  4. Yeah… ole made a few updates since this initial post, including MIDP support. Check out his site for details:

    Comment by David R — March 27, 2009 @ 2:54 pm

  5. Thanks for the well done job on Porting Java for NDS.
    Your friend Ole made a good enhacement enabling CLDC / MIDP application with his PSTROS.

    Quick questions:
    1) Does Java for NDS able to run audio ?
    2) Does PSTROS with Java for NDS able to run audio ?
    3) Are you working in enhancements to have MIDP 2.0 on both ?

    Comment by Fernando — October 26, 2009 @ 3:27 am

  6. 4) Is it possible to use both screens, together, with your Java / KVM port to NDS ?

    Comment by Fernando — November 2, 2009 @ 7:37 am

  7. No Wi-fi support, no Opera Mini. 🙁

    Comment by Rafael — December 5, 2009 @ 11:51 am

  8. Are you going to inlcude WiFi support? I requested it 😀

    Comment by Marti — December 13, 2009 @ 12:17 pm

  9. I’m gonna have to bump this old thread and point out…


    Comment by John Sirbu — April 19, 2011 @ 5:52 pm

  10. hi,I should say that you guys are great!
    But…it that all?I think it still can not support the jar…though I didn’t test the jad…

    Comment by bywuu — May 17, 2011 @ 6:30 am

  11. I tested the jad,it can work but then it showed:

    ! nds/pstros/video/system.dsf

    what does that mean???

    Comment by bywuu — May 17, 2011 @ 7:07 am

  12. i was wondering since the activity on this project slowed down if i can use the source of the .nds so i can use that to auto load things. Also do you have any documentation for the libraries?

    Comment by Erik Decker — August 19, 2011 @ 6:19 am

  13. Erik Decker: Yes, I released the source. And someone else updated it to support more stuff. Try reading the links above you.

    Comment by davr — August 19, 2011 @ 10:45 am

  14. enable jar, then dumb down minecraft. no random terrain, rather pre chosen saves that are put on the r4, and also, who needs sound, if its a classic version, kinda like the mobile os version. same for terraria. remove random terrains, and dumb down some stuff, i know nozzing!!!!

    Comment by connor — December 8, 2011 @ 2:13 pm

  15. nice but is still dont now how to make something with GUI 🙁

    Comment by Kingperer — June 24, 2012 @ 8:42 am

  16. I get the error “ALER>T: Strange value of thisIP” for everything with this VM. At first, it seemed to be caused by the arrays I was using in my code. So I rewrote my code to use no arrays, and it still happens. No clue what’s causing it, Google doesn’t help. This VM is simply throwing an a unique error.

    Comment by khoraski — February 23, 2015 @ 7:51 pm

  17. My goodness, this thing is barely stable. I figured out the “Strange value of thisIP” comes from having too many characters stored in a string. Why’s this throw an error? Who knows. I’m know getting an “Illegal stack size” error for absolutely no reason at all. The code is completely valid. This JVM is just incredibly unstable and regular coding for it is just not good.

    Comment by khoraski — February 24, 2015 @ 9:09 pm

  18. will minecraft work?

    Comment by coinman_1 — May 9, 2015 @ 8:59 am

RSS feed for comments on this post. TrackBack URI

Leave a comment

Powered by WordPress

Bad Behavior has blocked 667 access attempts in the last 7 days.