Shall I move from C to Java?

D

dick

Hi everyone,

I am planning to learn Java.

Can I access HW registers in Java? Or can I call C function from Java
program?

Thanks.
 
T

Tim Wescott

Hi everyone,

I am planning to learn Java.

Can I access HW registers in Java? Or can I call C function from Java
program?

Thanks.

Even though I don't know much about Java, I know these tidbits:

No, you cannot directly access hardware from Java. I would be surprised
to find a serious Java for embedded use that did not include library
functions to do so, however.

Java itself doesn't provide a means to call C functions, but most Java run
time environments provide a means to call external code. Of course, if
you're calling external code then you have to maintain code bases in C
_and_ Java...

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
 
D

dick

Tim said:
Even though I don't know much about Java, I know these tidbits:

No, you cannot directly access hardware from Java. I would be surprised
to find a serious Java for embedded use that did not include library
functions to do so, however.

Java itself doesn't provide a means to call C functions, but most Java run
time environments provide a means to call external code. Of course, if
you're calling external code then you have to maintain code bases in C
_and_ Java...

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html






If I design a HW platform, how can I run Java in this bare machine.
 
K

Keith Thompson

dick said:
If I design a HW platform, how can I run Java in this bare machine.

Your first step should be to find a newsgroup with "java" in its name.
 
S

Sheth Raxit

If I design a HW platform, how can I run Java in this bare machine.- Hide quoted text -
As per my basic understanding, for your hardware platform you need to
Develop or Port Java Run Time Environment <JVM , regret i am not java
guru and This is not Java-news group, regret if you think replying to
OT>

-Raxit
 
T

Tim Wescott

If I design a HW platform, how can I run Java in this bare machine.

You need a Java run-time environment to run Java, at which point the
machine would no longer (by my definition) be "bare".

--
Tim Wescott
Control systems and communications consulting
http://www.wescottdesign.com

Need to learn how to apply control theory in your embedded system?
"Applied Control Theory for Embedded Systems" by Tim Wescott
Elsevier/Newnes, http://www.wescottdesign.com/actfes/actfes.html
 
I

Ivar Rosquist

Hi everyone,

I am planning to learn Java.

So you can compile programs once in one platform, and run them
nowhere?
Can I access HW registers in Java?

I bet you can't.
Or can I call C function from Java program?

Yes - using JNI. The catch is that the overhead introduce by this
is such that in most cases the resulting code is almost as slow as an all
Java code.
 
C

Chris Dollin

Ivar said:
So you can compile programs once in one platform, and run them
nowhere?

Don't be (a) silly (b) atopical.
I bet you can't.

You can't in C, either.
Yes - using JNI. The catch is that the overhead introduce by this
is such that in most cases the resulting code is almost as slow as an all
Java code.

That is, of course, going to depend on how much work the C code does;
"most cases" is sheer handwaving.
 
C

Clever Monkey

dick said:
If I design a HW platform, how can I run Java in this bare machine.
[Please don't quote signature blocks. I've correct this here.]

This is, of course, getting way off-topic for comp.lang.c. I'm sure
there is an "embedded Java" newsgroup out there, and Google returns a
sick amount of hits for that phrase.

However, it may be instructive to consider that implementing embedded
systems does not have to be all bare-metal bit-banging. There is a
relatively long tradition of interpreted byte-code slinging in the
embedded world.

It really depends on your application and deployment.
 
L

larwe

Can I access HW registers in Java? Or can I call C function from Java
program?

Not directly, and yes, respectively.

There is an implementation of a JVM for AVR; I've seen it mentioned
briefly in c.a.e in response to a thread I posted asking something
related.

There is ALSO an implementation of a JVM for the Commodore 64 (a 1MHz
6502-family device, for those who don't know this).

The real question is, do you understand what Java will provide for
you, and what it will cost you (in terms of resources, performance
etc). I had very specific reasons for wanting to use Java in my
project (it was the PC UI side of an embedded system).
 
V

Vladimir Vassilevsky

larwe said:
What has Microsoft's proprietary closed nonsense got to do with Java?
Or, for that matter, embedded programming?

Stupid questions deserve equaly stupid answers.

VLV
 
L

larwe

On Aug 15, 10:23 am, Vladimir Vassilevsky
Stupid questions deserve equaly stupid answers.

The question may have been ill-formed but I do not have enough
information to judge that its intent was stupid.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top