tags:

views:

57

answers:

5

I'm still learning Java, but would like to embed a small Java program on a custom hardware device. I do however seem to be missing a degree in engineering... but perhaps someone here can point me in the right direction?

I would like to do something very very small and simple. My idea is to write a small Java application that controls 10-20 LED lights and make them flash in different patterns.

I would like to build (or purchase) a small custom device and place my Java application on it, thus having a small custom box with an "on" and "off" switch that would run my Java code, which would then be controlling the LEDS. When I flip the switch my code runs!

Are there starter kits or tutorials for this sort of thing? Would I need to buy a soldering ironiron...? I have tried google, but I am not sure what to actually google... Any guidance would be appreciated.

+3  A: 

You would have to compile the a JRE, most likely some version of J2ME for your selected hardware, a better choice is Arduino, and just bite the bullet and learn enough the Arduino langauge based on C/C++ Syntax to get by. There are lots of resources on the web for this board.

fuzzy lollipop
This looks really cool (and complex), it looks like it could do the trick. They actually have a Java interface: http://www.arduino.cc/playground/Interfacing/Java - I will investigate if it is still active, working, not void etc. I am not in a position to take on an additional language right now.
DonDon
that is a Java SERIAL port interface, it isn't for executing the code on the board, only for externally communicating with it. Learning the extremely limited Arduino language should be a hour or two at most if you already know a C-like language. Much shorter time than trying to compile the J2ME/JRE for some esoteric hardware.
fuzzy lollipop
+1  A: 

The problem with Java is that, while the class files are often tiny, there's a honking big runtime required to run them. Java SE is several megabytes. Java ME is made for embedded devices (think phones) and is smaller but not by much.

To get Java running on a piece of hardware, someone must port the Java runtime to run there. This really is a job for a systems engineer, as I think there's some low-level hacking involved. Certainly parts of the system will need to be re- and custom compiled.

As a rule of thumb: If whoever provides your hardware provides a Java runtime or mentions that one is available, all is well. If not, you need to go looking for a different solution.

At one point about 10 years ago, Sun was actually planning to create "Java chips," custom CPUs for running Java bytecode, and these would have been great for embedding Java in your toaster. However, they apparently did the numbers and concluded that it wasn't a viable business proposition. So Java today still does not run *every*where.

Carl Smotricz
A: 

Regarding the part of your question looking for general guidance, look at this fine web site using the embedded tag.

unhillbilly
Thank you. I did not know that this was the term to use.
DonDon
N.P. Good luck with whatever it is you are building -- I'm a huge fan of anyone making hardware. Also check out Make magazine (http://makezine.com/); specifically the electronic projects (http://makeprojects.com/Area/Electronics) and forums (http://forums.makezine.com/).
unhillbilly
A: 

For something to become very small and very simple you need to end up with native machine code.

Anything Java basically means you need to bring in a Java interpreter with Java libraries etc. etc. which automatically means that "very small" cannot be achieved. A few hardware platforms can help interpreting Java, but you still need the supporting runtime libraries.

For "very small" you still need to use C (or perhaps C++) and cross compile to the target platform.

Thorbjørn Ravn Andersen
By "very small" I meant easy. RAM (and perhaps ROM?) is not that expensive, I would rather pay more on the hardware side, than having to spend hours learning rudimentary C or C++...
DonDon
In that case I would recommend a SunSPOT set: http://www.sunspotworld.com/products/
Thorbjørn Ravn Andersen
I like it, but it looks a bit old, and everything is "TemporarilySold Out!"... But it was definitely something like this I was looking for. I have been googling "arduino for java" "arduino java clone" etc. bu t so far nothing.
DonDon
I have had access to one of those sets, and I am pretty certain it is exactly what you need. I was unaware that it was sold out.
Thorbjørn Ravn Andersen
These guys were mentioned as resellers, but they have at least two other Java technologies which might interest you: http://www.systronix.com/jstik/compare.htm
Thorbjørn Ravn Andersen
They have sunspots on sale for $299! http://www.systronix.com/store/bargains.html
Thorbjørn Ravn Andersen
This is what I was looking for. I will investigate further and buy one, of they ship to EU.
DonDon
A: 

Please learn C. This language is (next to assembly) the closest to the embedded machine you will be trying to program. C is not hard and the language manual is about 130 pages, not 600+ pages as with java. And you don't have to learn the whole language.

Arduino is a great platform to start with, but you will need to learn C for that.

Roalt