By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,853 Members | 2,186 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,853 IT Pros & Developers. It's quick & easy.

Shall I move from C to Java?

P: n/a
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.

Aug 14 '07 #1
Share this Question
Share on Google+
16 Replies


P: n/a
On Mon, 13 Aug 2007 22:07:16 -0700, dick wrote:
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
Aug 14 '07 #2

P: n/a

Tim Wescott wrote:
On Mon, 13 Aug 2007 22:07:16 -0700, dick wrote:
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



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

Aug 14 '07 #3

P: n/a
dick <di***********@hotmail.comwrites:
[...]
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.

--
Keith Thompson (The_Other_Keith) ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
Aug 14 '07 #4

P: n/a
On Aug 14, 9:26 am, dick <dick_12345...@hotmail.comwrote:
Tim Wescott wrote:
On Mon, 13 Aug 2007 22:07:16 -0700, dick wrote:
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

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
>
- Show quoted text -

Aug 14 '07 #5

P: n/a
On Mon, 13 Aug 2007 22:26:54 -0700, dick wrote:
Tim Wescott wrote:
>On Mon, 13 Aug 2007 22:07:16 -0700, dick wrote:
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


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
Aug 14 '07 #6

P: n/a
On Mon, 13 Aug 2007 22:07:16 -0700, dick wrote:
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.
Aug 14 '07 #7

P: n/a
Ivar Rosquist wrote:
On Mon, 13 Aug 2007 22:07:16 -0700, dick wrote:
>Hi everyone,

I am planning to learn Java.

So you can compile programs once in one platform, and run them
nowhere?
Don't be (a) silly (b) atopical.
>Can I access HW registers in Java?

I bet you can't.
You can't in C, either.
>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.
That is, of course, going to depend on how much work the C code does;
"most cases" is sheer handwaving.

--
Chris "(render unto \X that which is X's)(C | Java)" Dollin

Hewlett-Packard Limited registered office: Cain Road, Bracknell,
registered no: 690597 England Berks RG12 1HN

Aug 14 '07 #8

P: n/a
dick wrote:
Tim Wescott wrote:
>On Mon, 13 Aug 2007 22:07:16 -0700, dick wrote:
>>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...

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.
--
clvrmnky <mailto:sp******@clevermonkey.org>

Direct replies will be blacklisted. Replace "spamtrap" with my name to
contact me directly.
Aug 14 '07 #9

P: n/a


dick wrote:
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.

http://www.microsoft.com/mspress/books/10457.aspx
Vladimir Vassilevsky

DSP and Mixed Signal Design Consultant

http://www.abvolt.com
Aug 14 '07 #10

P: n/a
On Tue, 14 Aug 2007 20:15:12 +0000, Vladimir Vassilevsky wrote:
>

dick wrote:
>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.


http://www.microsoft.com/mspress/books/10457.aspx
It appears to have nothing to do with C <ot>nor with Java</ot>.
--
Army1987 (Replace "NOSPAM" with "email")
No-one ever won a game by resigning. -- S. Tartakower

Aug 14 '07 #11

P: n/a
On Aug 13, 10:07 pm, dick <dick_12345...@hotmail.comwrote:
Hi everyone,

I am planning to learn Java.
http://www.cafeaulait.org/javafaq.html
followed by news:comp.lang.java
Can I access HW registers in Java?
No.
Or can I call C function from Java
program?
Do a web search for "JNI java". It's a bloody pain in the posterior.
As far as I can see, you have no C questions whatsoever in your post.
Probably, Java questions go better in a Java group.
Aug 14 '07 #12

P: n/a
On Aug 14, 4:15 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
dick wrote:
Hi everyone,
I am planning to learn Java.

http://www.microsoft.com/mspress/books/10457.aspx
What has Microsoft's proprietary closed nonsense got to do with Java?
Or, for that matter, embedded programming?
Aug 14 '07 #13

P: n/a
On Aug 14, 1:07 am, dick <dick_12345...@hotmail.comwrote:
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).

Aug 14 '07 #14

P: n/a


larwe wrote:
On Aug 14, 4:15 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
>>dick wrote:
>>>Hi everyone,
>>>I am planning to learn Java.

http://www.microsoft.com/mspress/books/10457.aspx


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

Aug 15 '07 #15

P: n/a
On Aug 15, 10:23 am, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
larwe wrote:
On Aug 14, 4:15 pm, Vladimir Vassilevsky <antispam_bo...@hotmail.com>
wrote:
>dick wrote:
>>Hi everyone,
>>I am planning to learn Java.
>http://www.microsoft.com/mspress/books/10457.aspx
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
And you are always there to oblige, right? ;^)

Sorry, I couldn't resist...
Aug 15 '07 #16

P: n/a
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.

Aug 15 '07 #17

This discussion thread is closed

Replies have been disabled for this discussion.