Look at the Serial examples for how to use the Serial port. You would then just have to write the Java app that would open up a Serial connection to the Arduino and send commands.
Yes I already tried , but the example is for reading data , but I want to send data over the arduino. I don't really understand when I write output.write(...) , what parameter ? what mean "byte" ? and how to SELECT a pin to turn on ?
One easy way to get going is to install the Bitlash interpreter on the Arduino (http://bitlash.net). Then you can send commands from your Java program like:
public void loop () throws IOException, InterruptedException{
byte val =-1;
Byte b1 = new Byte(val);
while( true )
{
output.write(b1); // Turn LED on.
output.flush();
Thread.sleep(1000); // Wait one second
output.write(0); // Turn LED off.
output.flush();
Thread.sleep(1000);
System.out.println("Passage en boucle");
output.flush();
}
But when i make myArduino.loop() nothing append.
I dont know how to select a Pin , or how to Turn on that...
Well instead of trying to build everything at once, you should be starting small.
First start by defining your requirements; what commands should be sent to the Arduino? What should the Arduino do with those commands? Next, view some of the examples in the Arduino to see how to receive serial data; there are plenty of them. Get the Arduino part working to the point where you can type in commands to the serial monitor that will cause the Arduino to do what you want. From there, you then design the Java interface to replicate sending those commands.