#Flipper Zero Java Virtual Machine

1 messages · Page 1 of 1 (latest)

surreal cradle
#

Yes, we're perverts. Link: https://github.com/nectostr/ZeroJVM/tree/main

We present you a partial implementation of a Java Virtual Machine for Flipper Zero devices 😄
It successfully compiles to 16KB fap file and is capable of:

  • basic Java control instructions (stack operations, program flow control)
  • basic OOP (static & instance fields and methods, but working with a single Entrypoint class so far (but can spawn new instances, lol))
  • byte/short/int/float math
  • Text output to the display
  • Flipper Zero speaker control (yes, from Java)

How does it work:
You compile valid Java single class named Entrypoint with a Java compiler (javac) and upload resulting Entrypoint.class file to SD card root. ZeroJVM will find this file, locate public static void main and start execution.
See the repo: README.md, examples, and Makefile.

Q&A:

Q: Why the hell did you do that?
A: Programming courses, nothing interesting. Nothing production-oriented.

Q: Can I use it for my Java code?!
A: Yes, you can, No, you shouldn't, lol.
Most likely no without changes. It's a lazy and partially finished implementation of the JVM, we didn't implement everything (moreover, we implemented a rather small part of reference JVM), so read the examples and adjust your code as instructed.

Q: Do you plan to implement more features, develop, extend, etc?
A: 99% no, feel free to fork and extend.
Features to implement to make it stable:

  • Dynamic class loading (for imports of other classes)
  • Double/Long math
  • Reference types instructions (yes, we were very lazy, sorry)
  • Proper implementation of Object and System
    Fortunately, if you at least partially know how it works, it probably would be pretty easy.

Q: Any technical details about the repo I should know?
A: Yes:

  • Read makefile, target 'x86' is for x86 Linux PCs to debug, target 'flipper' and 'launch' are for compilation and uploading to the flipper
  • No garbage collection at all
  • Interpreter instead of JIT
  • Good luck
GitHub

Contribute to nectostr/ZeroJVM development by creating an account on GitHub.

marsh canyon
#

Wait doesn't Flipper use an ARM Cortex M4? I wonder if it has Jazelle and you can use it... cursed

#

A9 but my point still could stand

tiny holly
#

Minecraft in the flipper?

#

Ignore the gigabytes of memory it needs

surreal cradle
surreal cradle
clever nova
#

java + oracle = 🤮

swift lantern
#

Well, damn