7

I have recently learned some basic Java and was thinking of seeing if I can use these new skills for an embedded computing project. I have been looking around but I can't seem to be able to find any microcontrollers that are capable of running Java. Does such a thing even exist?

Ross Satchell
  • 341
  • 4
  • 14
  • Read about Java arm: http://hackaday.com/2012/10/09/bringing-java-to-the-world-of-microcontrollers/ . I have experience only with atmel AVR and SAM microcontrollers where C language is the king. – Springfield762 Jul 24 '15 at 06:04
  • 1
    Arduino http://haiku-vm.sourceforge.net/ or BeagleBoard http://beagleboard.org/BLACK – André Schild Jul 24 '15 at 06:12
  • This is probably a duplicate of http://stackoverflow.com/questions/16031613/java-in-embedded-programming/16034796, but as that question is somewhat old and things move on, I suggest this question is allowed to stand in order to revisit the current state-of-the-art. But you really should have searched SO first - you'd have certainly come to a different conclusion than you currently hold. – Clifford Jul 24 '15 at 07:00
  • @AndréSchild : Your comment deserves expansion into an actual *answer*. You should avoid posting answers in the comments - especially if they are as useful as that appears to be - though link only answer s should be avoided; so add some detail. – Clifford Jul 24 '15 at 07:02

5 Answers5

6

Because of Java virtual machine architecture, you need considerable resources just to run the JVM. The path of least resistance to getting an JVM is probably to run an OS on the target that already supports it such as Linux, but that itself requires relatively huge resources.

There are a few stand-alone JVMs that either work bare-metal or integrate with and embedded RTOS for threading support. I compiled a list a while ago in an answer to a similar question, but some of the links are now out of date.

Running Java on an embedded system will certainly hit performance, and is probably not suited to hard real-time applications without a great deal of care.

Clifford
  • 88,407
  • 13
  • 85
  • 165
5

Microcontrollers are not made for this use. Controllers called "mini computers" can embed JAVA applications (Raspberry PI, BeagleBone, Intel Edison, etc, because they embed an OS, and so can use JRE).

For microcontrollers, C/C++ are really better and more reliable.

Aeldred
  • 314
  • 2
  • 15
  • 2
    Not the usual meaning of ["minicomputer"](https://en.wikipedia.org/wiki/Minicomputer). More usually "Single-board computer" or SBC. perhaps? – Clifford Jul 24 '15 at 08:58
  • These "minicomputers" are in fact not related to microcontrollers, because they are ARM-architectures and almost exactly like real computers, e.g. you can't run real time applications on SBCs. – Klaus Jul 24 '15 at 09:05
4

Microcontrollers are meant for real low level - they normally don't have much functionality and won't have enough memory/processor speed to run JAVA.

Most entry level microcontrollers use C/C++ and maybe even their own variant of it.


Arduino/Atmega uses Haiku VM to run java. Using the haiku VM you can compile your JAVA code into C - and this will be programmed into Arduino. This makes debugging a little difficult, but it's not that bad - and hey, a high level language like JAVA cuts down your coding time a lot. Issue with this is normally your memory will get over soon, and you cant write huge pieces of code.

PIC - Muvium claimed support for PIC, but they stopped supporting it after a while and have closed down now. I don't think PIC has JAVA support for now.

Renesas is another popular microcontroller provider which has it's own SDK called MicroEJ for java o n RX and RZ boards of theirs. I've never used it, but their boards boast more RAM and flash memory - which helps a lot.


Single board computers (basically, a microcontroller/processor which is more powerful + has more peripherals) is useful when using JAVA for embedded programming. The two most popular ones are Beagle bone and Raspberry Pi. These are basically computers on a chip - and can run a full fledged ARM Ubuntu + Java/Python/any other language.

The easiest to use is Raspberry Pi (in my opinion) - which has huge community support.

AbdealiLoKo
  • 3,261
  • 2
  • 20
  • 36
  • 1
    Both Beagle Bone and and Raspberry Pi are examples of single-board computers rather then microprocessors. Both use ARM core microprocessors. They are capable of running Java primarily due to their support for Linux, but you need relatively large resources just to boot Linux. – Clifford Jul 24 '15 at 06:44
  • Minimal linux like slitaz or puppy can easily run without too many resources - and ROS + JAVA can be easily run on top without much performance hinderance. – AbdealiLoKo Jul 24 '15 at 07:21
  • 1
    "too many resources" is subjective and platform dependent. A minimal Linux boot still requires >4Mb Flash and >8Mb RAM. Many embedded systems have memory of the order of tens of kilobytes. The performance hit of Java comes from run-time decoding of bytecode. Even with JIT compilation, it will be slower than native C/C++ code and far less deterministic. "without much performance hindrance" is also subjective and application dependent; if your application has real-time deadlines in the order of microseconds, Java is not the tool to use. – Clifford Jul 24 '15 at 08:56
0

Recently I started working on a CM12001/1000000 board that runs Java. It contains two controllers on the same board. Currently I do not have much knowledge of this thing. I will update the answer as soon as I get more info.

To answer your question: Yes, such a thing exists, but it is quite rare. Python however is gaining popularity in the embedded field recently using MicroPython, that includes a small subset of the Python 3 standard library and is optimized to run on micro-controllers.

Edit: ATOP Modules from Telit provide such functionality. Generally they have good amount of both RAM and Flash(A few MB to a few hundred MB). They run Linux over which they load JVM (as pointed by Clifford). Telit provides Java APIs to so control stuffs like GPIO (though very limited) and do stuffs like serial communications, GPS, GSM control etc.

Kundan Kumar
  • 471
  • 2
  • 6
  • 10
0

Yes, microcontrollers that are capable of running Java on the bare metal exist

But JVM on this microcontrollers optimized for speed, and low memory usage. It's mean optimized JVM have some limitation instead of regular JVM, it's like Python and MicroPython

But pure code on Java allow you to transfer code with ease from the desktop to a microcontroller or embedded system

For self education with embedded computing project you can try to use Javaino allow execute Java programs on this development board, read data from sensors via i2c, UART, etc like Arduino

452
  • 396
  • 4
  • 9
  • 24