Java and embedded devices

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Dec 2004
Posts: 489
Reputation: Acidburn is an unknown quantity at this point 
Solved Threads: 5
Acidburn Acidburn is offline Offline
Posting Pro in Training

Java and embedded devices

 
0
  #1
Jul 6th, 2008
Hey guys,

Most embedded devices suc as the Amtel boards seen to require C / C++ programming, why don't they support Java? Is it question of performance? Or am I overlooking something?
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 15,644
Reputation: Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute Ancient Dragon has a reputation beyond repute 
Solved Threads: 1498
Team Colleague
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Still Learning

Re: Java and embedded devices

 
-1
  #2
Jul 6th, 2008
Probably because java is a memory hog, it runs slower because its an interpreted language, and C/C++ languages let you get much closer to the hardware than java does.
Don't PM me with questions -- you might get a nasty PM in response. If you have a question then post it in one of the forums.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 251
Reputation: ssharish2005 is on a distinguished road 
Solved Threads: 20
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: Java and embedded devices

 
1
  #3
Jul 10th, 2008
In addition to what Ancient Dragon said, YES java can be used to program some low level devices. As far I know it is quite used in the mobile programming and in Bluetooth and many others. Well what you need to understand here is the fact that they are all running on a specific platform. You write a program using java for a mobile device and the program get compile to generate a bytecode which is then interpreted by the Java Virtual Machine (JVM). You can clearly see that the target device should be installed with the JVM, which it does on most devices.

Now, let’s think it practically with the ATMEL AVR board. These boards come with the AVR microcontroller which has a very small amount of memory. We are speaking in KB’s. We use several techniques to improve the efficiency of the code to make use of the memory effectively. When it comes to ATMEL we are speaking of three types of memory flash, SRAM, eeprom.

The ATML AVR board doesn’t come with any RTX or RTOS with it. The only software which gets shipped is the boot loader. It doesn’t come with JVM. The JVM its self needs a specific platform to run which the AVR doesn’t support (I might be wrong).

And more over java doesn’t support pointers, and for programming an embedded system you need pointer. Since I don’t program java I am not pretty sure about it. I think its some like C++ isn’t?? But you can still program an embedded system using C++.

Hope you get an ides on why java isn’t the right language to program any level devices. Here is a small brief:

1. Java compiles the code to bytecode, not binary
2. It requires a JVM
3. It’s slow
4. Lack of pointers.
5. Needs huge amount of memory.

And remember ATMEL AVR are RISC based processor. Does JVM support RISC architecture??? From my research it seems that ARM can execute some Java bytecode!!! But I havn't persoanlly tried.

As you could see there are of lots things which you need to be considered.

ssharish
Last edited by ssharish2005; Jul 10th, 2008 at 8:38 pm.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 973
Reputation: Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough Alex Edwards is a jewel in the rough 
Solved Threads: 107
Alex Edwards's Avatar
Alex Edwards Alex Edwards is offline Offline
Posting Shark

Re: Java and embedded devices

 
0
  #4
Jul 10th, 2008
Originally Posted by ssharish2005 View Post
...

1. Java compiles the code to bytecode, not binary
2. It requires a JVM
3. It’s slow
4. Lack of pointers.
5. Needs huge amount of memory.

And remember ATMEL AVR are RISC based processor. Does JVM support RISC architecture??? From my research it seems that ARM can execute some Java bytecode!!! But I havn't persoanlly tried.
...

ssharish

A Question about bytecode vs binary - does this mean that instead of converting the data directly into binary that instead the data is separated by chunks of bytes?

Excuse my ignorance if this is wrong.
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 251
Reputation: ssharish2005 is on a distinguished road 
Solved Threads: 20
ssharish2005's Avatar
ssharish2005 ssharish2005 is offline Offline
Posting Whiz in Training

Re: Java and embedded devices

 
1
  #5
Jul 10th, 2008
A bytecode is set of instruction which is generated the by a java compiler. This bytecode can then be ported to any machine regards of the on what platform and processor architecture of the target machine is! The bytecode will then be interpreted by the Java Virtual machine (JVM) which then internally creates a binary which can then be executed by the local machine or whatever the processor architecture which the local machine has been implemented. The JVM holds the complete system spec. So that when it interprets the byte code it knows on what platform its working and what sort of binary it has to produce.

But when we speak about binary, it is something which the compiler generates it for us. When you compile a C code by a C compiler, example GCC, it created .exe file or a binary file which can then be executed. The GCC doesn’t create byte code instead it creates a binary. But what you should remember is that, when you compile your code for your embedded system, you should compile your code to get the binary which can then be executed by the processor which is there on the embedded board but not our host machine.

Because those both are completely different in terms of processor architecture. But thanks for the GCC. It can create binary for a wide range of processor. And hence it’s called native compile. The compile which can generate binary for specific processor architecture is called Cross compile or a native compiler.

So you could see the potential of what the bytecode and the binary is. While programming embedded programming you should thinking about more than a programmer since you will have to consider more than one thing. But the thing which I like about it is that, the program you write will be executed on just one board. So, no need to consider any multiple architectures or the portability issues. You are free to use anything. But it’s a good practice to follow standards still
Hope that answers your question.

ssharish
Last edited by ssharish2005; Jul 10th, 2008 at 10:33 pm.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum


Views: 1066 | Replies: 4
Thread Tools Search this Thread



Tag cloud for Java
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC