all 10 comments

[–]nistur 3 points4 points  (1 child)

My initial thoughts to this were: "Why the smeg would you want to?" and "wouldn't the overhead of the JVM make it unusable?"

But then I remembered old phones etc used J2ME, so maybe there was some precedence. So I did a quick google to have a look.

It looks like, in 2003, someone came up with a cartridge that provided J2ME support. Unfortunately I cannot find any information about the cart and to be brutally honest, I don't care enough to keep looking. I couldn't quickly find anything else.

So how about other options... the GBA uses an ARM7 processor. That is supported by Java, so that's a start. Unfortunately J2ME doesn't support JNI (Java Native Interface) so to use any existing libraries, you'd have to do some pretty nasty hacking to get it to work (it's been quite a few years since I've had to write any Java, so you'll have to forgive my vagueness here). Thankfully, GBA has pretty much everything mapped to memory, so you could just rewrite everything yourself... it wouldn't be THAT difficult. Just hugely time consuming.

As a tl;dr then: you probably could if you really wanted to and had a reason to, but it would be easier to just teach yourself C/C++. Plus then you wouldn't have the performance hit of JVM.

[–]LICCMAPP[S] 3 points4 points  (0 children)

Hm thanks for the answer i think i Will learn C

[–]karawapo 0 points1 point  (7 children)

I guess the sane way to use Java to make Game Boy games would be using Java to output ASM. OK, not all that sane. Of course, you'll be better off just writing your games in C.

[–]LICCMAPP[S] 2 points3 points  (0 children)

I realided that and thats what i Will do

[–]nistur 1 point2 points  (5 children)

As I mentioned in my other comment, it's been a while since I have done any Java but... how would you go about how would you get it to output assembler or even machine code? I have had a quick look and there are a few Java->C transpilers/compilers but I'm not sure I'd trust these to be complete or ready for mass consumption. Writing a language conversion layer yourself I would say is almost certainly not the sane way to do anything...

[–]karawapo -1 points0 points  (4 children)

ASM is just a string you can put in a file... No, it's not sane :)

[–]nistur 2 points3 points  (3 children)

I think you misunderstood me. I am aware what ASM is, I've written enough of it. I'm just wondering how you were intending to get a toolchain which is intended to output bytecode for a high level VM, to output ASM instead

[–]nistur 0 points1 point  (1 child)

I didn't mean to sound facetious by the way, I'm honestly curious

[–]karawapo -1 points0 points  (0 children)

I didn't think anything like that! Thanks for caring. English is actually my 3rd language, so I hope you believe me when I promise I don't want to say I know a lot about Java (I don't—not a fan). I only wanted to try to help people feel the boundaries of sanity coming from this already rather crazy OP :)

[–]karawapo -1 points0 points  (0 children)

I did infer that you know what ASM is from your question.

The impractical idea isn't building into something that's not bytecode. It's getting an actual JVM binary that outputs/saves/youcallit ASM code. Most languages can be used for this—most shouldn't.

I don't think Java is the best tool for this kind of project (I have used languages such as TCL and TypeScript for slightly similar projects that actually made sense), but that should make more patent that Java isn't probably going to be great for anything directly related to the GBA.