How to red serial communication to a textfile?

I found this little program on the web to save data sendt from the arduino to a textfile.
(http://electronics.stackexchange.com/questions/54/saving-arduino-sensor-data-to-a-text-file)

import processing.serial.*;

Serial mySerial;
PrintWriter output;

void setup() {
  size(100, 100);
  mySerial = new Serial(this, "COM3", 9600);
  output = createWriter( "data.txt" );
}
void draw() {
    if (mySerial.available() > 0 ) {
         String value = mySerial.readString();
         if ( value != null ) {
              output.println( value );
         }
    }
}

On arduino is running a simple code:

void setup() {
  Serial.begin(9600);
}
void loop() {
  Serial.println("Test-data..");
  delay(200);
}

I get the following error in the processing terminal:

Error inside Serial.()

table Library

Native lib Version = RXTX-2.1-7
Java lib Version = RXTX-2.1-7
gnu.io.PortInUseException: Unknown Application
at gnu.io.CommPortIdentifier.open(CommPortIdentifier.java:354)
at processing.serial.Serial.(Unknown Source)
at processing.serial.Serial.(Unknown Source)
at sketch_130802a.setup(sketch_130802a.java:26)
at processing.core.PApplet.handleDraw(PApplet.java:2245)
at processing.core.PGraphicsJava2D.requestDraw(PGraphicsJava2D.java:243)
at processing.core.PApplet.run(PApplet.java:2141)
at java.lang.Thread.run(Thread.java:662)

Any help on why it’s not working is appreciated.

Best regards from Kresten

I use Realterm to save to text files:
http://realterm.sourceforge.net/

Works great. Thanks.
I still wonder why I can’t make the code work.