[Solved] Can Java run directly on hardware?


Directly on hardware? I am assuming you mean to ask if Java can run on a micro-controller? The answer is yes. The JVM is a virtual machine which is essentially its own operating system. The JVM was designed to do exactly what your wondering about. The JVM’s two primary functions are to allow Java programs to run on any device or operating system, “Write once, run anywhere” and to optimize memory solutions.

To answer your second question. In order to visually see the output of a System.out.println() call one would simply need to provide the micro-controller with a screen. However, in theory the code would still execute without you seeing it being displayed. So one could write a Java applet that prints “hello world” and then load it onto a micro-controller and run it but that’s just silly.

EDIT: I assumed you were not asking: “Can you program a micro-controller with Java” Silly of me, the answer is yes you certainly can; however, you wouldn’t want too because the JVM is rather large and it would take up a lot of space. That being said, if you are interested take a look at: the STM32 Java-ready micro-controllers or the Renesas RX. Also, you could run a gutted JVM using uJ or NonvoVM.

5

solved Can Java run directly on hardware?