Help communicating DIY Muscle Sensor with Processing Program! [SOLVED]

Hello,

I have built a Muscle Sensor through this Instructable: http://www.instructables.com/id/Muscle-EMG-Sensor-for-a-Microcontroller/

However,I am stuck in the Instructable (step 12) that shows how to Communicate the Arduino with the Computer to analyze the Data from the Sensor (which is this: www.instructables.com/id/USB-Biofeedback-Game-Controller/step12).

I have compiled and Uploaded the Sketch to my Arduino, I have downloaded the latest Processing, and opened the Processing Program with it.

I click on the run button but I get the following output:

Listening for transport dt_socket at address: 8819
Stable Library
=========================================
Native lib Version = RXTX-2.1-7
Java lib Version   = RXTX-2.1-7
java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1
	at processing.core.PApplet.runSketch(PApplet.java:10460)
	at processing.core.PApplet.main(PApplet.java:10265)
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1
	at AnalogVisualizationProcessing.<init>(AnalogVisualizationProcessing.java:51)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at java.lang.Class.newInstance0(Class.java:355)
	at java.lang.Class.newInstance(Class.java:308)
	at processing.core.PApplet.runSketch(PApplet.java:10458)
	... 1 more

The code should at first print some variables so, since it doesn't here, it isn't an Error in communication with the Arduino or in the Arduino Program.

I am not familiar with Processing, so If anyone knows how to solve this issue, please post!

If needed, here is the Program Code: (links for the two programs in the Instructable also...)

/*
*  By Hannah Perner-Wilson, www.plusea.at
*  Modified 3/30/2012 By Brian E Kaminski, www.AdvancerTechnologies.com
*
*  IMPORTANT!!:
*  Scroll down to set your serial port
*  Scroll down to set your thresholds
*/

import processing.serial.*;

// definition of window size
// you can change the size of the window as you like
// the thresholdGraph will be scaled to fit
// the optimal size for the thresholdGraph is 1000 x 400
int xWidth = 1200;
int yHeight = 750;

// xPos input array, using prefix
int[] xPosArr= {0,0,0,0,0,0}; 

// 
int[] messageArr= {0,0,0,0,0,0}; 
  
// Arrays for threshholding
int[] threshMax= {0,0,0,0,0,0}; 
int[] threshMin= {0,0,0,0,0,0}; 
  
// variables for serial connection. portname and baudrate are user specific
Serial port1;

//Set your serial port here (look at list printed when you run the application once)
String V3 = Serial.list()[1];
String portname1 = V3;
int baudrate = 9600;
  
int prefix = 10001;
boolean myCatch = false;
String serialIN = "";
String serialINPUT = ""; 
String buffer = ""; 
int value = 0; 

// ThresholdGraph draws grid and poti states
ThresholdGraph in;

void setup(){
  // set size and framerate
  size(xWidth, yHeight);
  frameRate(25);
  background(255);
  strokeWeight(5);
  stroke(0);
  smooth();
  strokeCap(ROUND);

  // establish serial port connection      
  port1 = new Serial(this, portname1, baudrate);
  port1.bufferUntil('\n') ;
  println(Serial.list());  // print serial list

  // create DisplayItems object
  in = new ThresholdGraph();
  
  // THRESHOLD VALUES:
  // using the thresholdGraph you can determine the MIN and MAX values
  // of your sensors. Enter these here. They must lie between 0 and 1000.
  
    //MIN trashhold
    threshMin[0] = 20;   // one
    threshMin[1] = 20;   // two
    threshMin[2] = 20;   // three
    threshMin[3] = 20;   // four
    threshMin[4] = 20;   // five
    threshMin[5] = 20;   // six
    
    //MAX trashhold
    threshMax[0] = 600;   // one
    threshMax[1] = 600;   // two
    threshMax[2] = 600;   // three
    threshMax[3] = 600;   // four
    threshMax[4] = 600;   // five
    threshMax[5] = 600;   // six
}//end setup

// draw listens to serial port, draw 
void draw(){
  
  // listen to serial port and trigger serial event  
  while(port1.available() > 0){
        serialIN = port1.readStringUntil('\n');
        //println((int)float(serialIN));
        if(serialIN != "")
          serialEvent(serialIN);  
        else
          println("found empty");
        }
        
  // threshold serial input  
  threshHolding();  

  // draw serial input
  in.update();
}//end draw()

If anybody can help, I would appreciate it!
Thanks!

String V3 = Serial.list()[1];

What is this going to do it there is only one item in the list? What is it going to do if the list is empty?

Here's a hint:

java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException: 1

I changed it to String V3 = Serial.list()[0];

Now it works fine! Thank you very much!