problems reading data from Processing in arduino

  if(Serial.available() >17)
  {
    while(Serial.peek() != '\n')
        {
          char c = Serial.read();
           string1 = string1 + c;
        }
    Serial.print(string1);
}

You know that there are 17 characters to read. Why do you need a String? Use a char array.

Where do you reset string1? (Or the char array, when you get smart).

At some point, it just might actually be necessary to read that carriage return to make it go away.