communication between arduino and PC

hi
i'm trying the SerialCallResponse communication exemple from the included 1.0.5.r2 database.
So the program sends the 'A' character on the COM3 port. When i launch a java code to listen the COM3 port (like this one: , it's said in Eclipse:

java.io.IOException: Underlying input stream returned zero bytes

What's the problem?

You will need to provide a lot more information.

Is it the Arduino or the PC that is sending the 'A'?

Assuming it is the Arduino, is the output visible in the Arduino Serial Monitor? If so it shows that the Arduino is working properly.

There are many other Threads here (some very recent) about using Java to communicate with an Arduino - get Google on the job.

I am loathe to ask you to post your Java code (because I don't like Java), but you should do so.

A common problem is that the PC program does not wait long enough for the Arduino to reset after the serial port is opened.
Another common problem is when the PC program closes and reopens the serial port between messages - causing the Ardino to reset.

...R

i don't know why the arduino program didn't work, but i try another exemple and, in fact, i understand that the command 'Serial.println(i);" is what i looked for and it works fine with the pc thanks to the java program. It's really easy
(the codes are available through the links i gived)

in fact, sometimes the java code return an ioexception error (but the program doesn't crash, and if i don't look at the console, it works perfectly) when the arduino sends something to the PC. Do you see what i mean?

moijdik:
Do you see what i mean?

To be perfectly honest, I don't have a clue.

You didn't answer any of my questions. I wonder why I wasted my time writing them?

...R

sorry, someone has given to me an arduino for test, and i can't test with the serial monitor when the arduino sends an 'A'
I have given the code through the links...
I have taken codes from arduino datase, so i wondered why it didn't work. When i will have the arduino, i will try to understand better, but the conclusion is that the solution to communicate from arduino to PC is just 'serial.println()'

Can the common problems you talked about be solved? can we control the serial port parameters on PC?

moijdik:
Can the common problems you talked about be solved?

Yes, very easily once you are aware of them.

You might get some value from the Python example in this Thread. The general principles apply to any language.

If you are new to this I suggest the first thing you do is get a simple Arduino sketch working with the Arduino Serial Monitor so that you can reliably send a few characters to the Arduino and have it send them back.

Then, without changing the Arduino code write a simple Java program to do what you were doing with the Serial Monitor.

By doing it like that you only have to deal with one complication at a time.

If you look in the Section Interfacing w/ Software on the Computer you should find a few recent Threads about Java programs.

What Serial library are you using with Java? RxTx seems to be falling out of favour in place of JSSC which seems to be easier to use.

...R