Processing to Arduino communication

When I do this with Ruby it works fine.
I only want to do the same, but with Processing.

The ruby code:

require 'serialport'

port_str = "/dev/tty.usbmodem621"  #may be different for you
baud_rate = 9600
data_bits = 8
stop_bits = 1
parity = SerialPort::NONE
sp = SerialPort.new(port_str, baud_rate, data_bits, stop_bits, parity)
 
#just read forever
while true do
  sp.write('A')
  sleep(500)
end
 
sp.close