Quick Processing question

I have searched for an answer to this, and haven't found a direct answer to this. I know it has been asked many times, so please stick with me here.

Using the dimmer program to dim the LED that is given in the tutorials, I downloaded processing and am using that instead of max/msp. I receive this error:

Available serial ports:
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2

I know that this means the RXTX version is not the same between java and the native library, which means it can't communicate properly? I am using ubuntu 10, and most places where I searched for this error included instruction in windows or mac, which is different as you can tell.

Where I'm confused is does that mean the processing IDE and the arduino IDE are running the different RXTX versions, and I think it is the arduino side that is out of date? So would the best thing be to delete out any RXTX related files from the arduino lib and extract the download for 2.2pre2 to that folder?

Thanks in advance, and sorry if this question has been directly answered but I haven't found anything very specific. I'm new to programming and am most interested in learning as much as I can through the arduino environment and community.

Is the program working? I get that warning, but things seem to work anyway. If not, the Processing site would be the correct place to ask questions, rather than here.

does that mean the processing IDE and the arduino IDE are running the different RXTX versions

Not necessarily. It just means that somewhere in your path, there is a newer version of RXTX than Processing expects.

I receive this error:

Carefully read all the words in the message:

WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2

Where do you see "error"?

I know that this means the RXTX version is not the same between java and the native library, which means it can't communicate properly?

It means nothing of the sort.

OK well I guess I'm wrong. I tried figuring it out on my own and have had nothing work, so that's why I came here... I didn't include the entire problem. Here is what I get:

Available serial ports:
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2
Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 0
at sketch_jan10a.setup(sketch_jan10a.java:40)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)

I haven't gone to the processing forums for various reasons I don't deem necessary to include. I'm using the code given in the example for this. I don't need a straight answer, but at least a little bit of direction please.

The program brings up the box that should have a gradient on it, but there is no gradient and the program doesn't function.

Thanks

The error message is telling you what the problem is...

Exception in thread "Animation Thread" java.lang.ArrayIndexOutOfBoundsException: 0
at sketch_jan10a.setup(sketch_jan10a.java:40)
at processing.core.PApplet.handleDraw(Unknown Source)
at processing.core.PApplet.run(Unknown Source)
at java.lang.Thread.run(Thread.java:662)

Yes I understand that. But how is that out of bounds? That is the code given in the example:

// Dimmer - sends bytes over a serial port
// by David A. Mellis
//This example code is in the public domain.

import processing.serial.*;
Serial port;

void setup() {
size(256, 150);

println("Available serial ports:");
println(Serial.list());

// Uses the first port in this list (number 0). Change this to
// select the port corresponding to your Arduino board. The last
// parameter (e.g. 9600) is the speed of the communication. It
// has to correspond to the value passed to Serial.begin() in your
// Arduino sketch.
port = new Serial(this, Serial.list()[0], 9600);

// If you know the name of the port used by the Arduino board, you
// can specify it directly like this.
//port = new Serial(this, "COM1", 9600);
}

void draw() {
// draw a gradient from black to white
for (int i = 0; i < 256; i++) {
stroke(i);
line(i, 0, i, 150);
}

// write the current X-position of the mouse to the serial port as
// a single byte
port.write(mouseX);
}

There is the code for easy reference. Am I correct to assume this is the zero (red) that is out of bounds? The comments say to replace that with the port used by my arduino. I'm not too familiar with how to find that port, other than under where it is selected in the arduino IDE, which is /dev/ttyacm0 (or something similar, sorry I'm not on my computer at the moment). That isn't a number, so how would I set that?

I admit I know nothing about communication, thus why I'm here. I apologize that this is trivial.

EDIT

Would it be best to use this:

//port = new Serial(this, "COM1", 9600);

to set the serial port? I could do "$ dmesg | grep tty" to check for which serial port is being used and use that /dev/tty port replaced with "COM1"? I see that COM1 is a windows difference.

I will come back when I can get to my computer and try this to verify if that is indeed my issue.

port = new Serial(this, Serial.list()[0], 9600);

Serial.list()[] is out of bound in your code. That line expext a number from 0 to ? So what is the number ?

So my computer is not your computer, and your computer is not my computer, therefore the number is the port number show in the next code where your Arduino is connected.

That code will show all the ports connect to your computer. Simply place the number represent the port where the Arduino is.

import processing.serial.*;
// The serial port:
Serial myPort; 
// List all the available serial ports:
println(Serial.list());

The next code is to tested. Here is the Processing code to send a "simple" hello to the Arduino.

import processing.serial.*;

Serial myport;

int portindex=3; // My Ardiuno is connect to number 3 at the moment of the test.

void setup()
{
   size(200,200);
   println(Serial.list());
   println("Connecting to "+Serial.list()[portindex]);
   myport = new Serial(this,Serial.list()[portindex],2400);  
   myport.write("This is a test");
}

void draw ()
{
  
}

And here my Ardiuno code. I use a LCD because the serial monitor in the IDE will not work when Processing is sending data.

#include <LiquidCrystal.h>

LiquidCrystal lcd (7,8,9,10,11,12);

byte incom;

void setup()
{
  Serial.begin(2400);
  lcd.begin(16,2);
  lcd.clear();
}

void loop()
{
  if (Serial.available()>0)
  {
    incom=Serial.read();
    lcd.write(incom); 
  } 
}

Yes I understand that. But how is that out of bounds?

The answer to that question is in your first post:

Available serial ports:
WARNING: RXTX Version mismatch
Jar version = RXTX-2.2pre1
native lib Version = RXTX-2.2pre2

In between the "Available serial ports:" and hte "WARNING..." are the serial ports that Processing knows about. The first one is at index 0. You can maybe see that there isn't even one, so even index 0 is out of bounds for an empty list.