Connect to an Arduino from a Processing from 2 different PC

Hi,

I have a processing program that uses Serial in order to connect to an Arduino. On my PC1 the arduino is connected to COM1 (second of the array). String portName = Serial.list()[1]; myPort = new Serial(this, portName, 9600);

When I am exporting my process and try to execute the .exe on another computer I am getting an error because the arduino is connected to another port...

From my process how can I know in which port/COM the arduino is connect?

Thanks for your help!

Well I always look for the name of the device I am trying to connect to with code like this:-

  String adaptor = "/dev/tty.usbserial-FTEJUA6O";  // the name of the device driver to use

void portConnect(){      // Open the port that the controller is connected to
     // **********************************
    // if the device you are looking for is 
    // not available the program will 
    // connect to the first one in the list
    // ************************************
    int portNumber = 99;
    String [] ports;
     // println(Serial.list()); // uncomment for full list of serial devices
    ports = Serial.list();
      for(int j = 0; j< ports.length; j++) { 
    if(adaptor.equals(Serial.list()[j])) portNumber = j;         
    } // go through all ports
    if(portNumber == 99) portNumber = 0; // if we haven't found our port then connect to the first one
    String portName = Serial.list()[portNumber]; 
    println("Connected to "+portName);
    cnc = new Serial(this, portName, 9600);
    cnc.bufferUntil(10);  // call serialEvent every line feed
 }