IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy

I have a fairly basic Processing program I made in 2013 to controll solenoids using an arduino card with FirmatA installed. the original worked very well but is having issues with windows 10. I wanted to update it from 1.5.1 to run using a newer version of Processing but am not having any luck. When I try to run the program from the editor in P3.5.4 I get this error

“IllegalAccessError: tried to access class processing.core.PApplet$RegisteredMethods from class cc.arduino.Arduino$SerialProxy
Could not run the sketch (Target VM failed to initialize).”

It seems to hang up on this line:
arduino = new Arduino(this, Arduino.list()[1], 57600);

Its like the arduino library is not installed or something.

ALSO, Even though the script runs the program perfectly from the 1.5.1 editor, I am unable to export and get a viable standalone app any more. The editor will export and create the files but when I try to run them I just get a blank screen of death. I assumed this was related to the outdated Processing editor not being able to use the current JAVA.

just as FYI, This controlls odor release to bees via solenoids. It is used by an entomologist to test the learing in bees. Similar to Pavlov’s dog, as an odor is released the bee is given some sugar water. After a while the bee will expect the sugar and extend its proboscus in response to the stimuli without any sugar water being offered. They named the device the “Olfactometer”

This is the exact code I am running in both 1.5.1 and 3.5.4

import processing.serial.;
import cc.arduino.
;
import controlP5.*;
Arduino arduino;
int lastComPort;

Scrollbar bar1, bar2, bar3, bar4, bar5, bar6, bar7, bar8, bar9, bar10;

Radio[] buttonsA = new Radio[1];//one radio button for each potential solenoid to initiate the exp.
Radio[] buttonsB = new Radio[1];
Radio[] buttonsC = new Radio[1];
Radio[] buttonsD = new Radio[1];
//Radio[] buttonsE = new Radio[1];

Check check;
Check ConstantON;
Check AllInOrder;

void setup() {
size(900, 900);//setting the size of the window
smooth();
println(Arduino.list());
String[] arduinoList = Arduino.list();
//lastComPort =(arduinoList.length -2);//find and identify the Arduino Com port to use
//println (arduinoList.length -1);

// arduino = new Arduino(this, Arduino.list()[lastComPort], 57600);
// x, y, size, base color, fill color, id number, array of others
arduino = new Arduino(this, Arduino.list()[1], 57600);//A new and better way to identify the COM port being used
//arduino.pinMode(ledPin, Arduino.OUTPUT);

buttonsA[0] = new Radio(680, 80, 15, color(255), color(0), 0, buttonsA);
buttonsB[0] = new Radio(680, 192, 15, color(255), color(0), 0, buttonsB);
buttonsC[0] = new Radio(680,304, 15, color(255), color(0), 0, buttonsC);
buttonsD[0] = new Radio(680, 416, 15, color(255), color(0), 0, buttonsD);
// buttonsE[0] = new Radio(680, 528, 15, color(255), color(0), 0, buttonsE);

bar1 = new Scrollbar(70, 60, 500, 15,0.0, 30.0);//Inputs:x,y,width,height,min,max // delay solenoid 1
bar2 = new Scrollbar (70, 90, 500, 15,0.0,5.0);// odor time solenoid 1
bar3 = new Scrollbar (70, 170, 500, 15, 0.0, 30.0);//Delay time solenoid 2
bar4 = new Scrollbar (70, 200, 500, 15, 0.0, 5.0);//Odor time solenoid 2
bar5 = new Scrollbar (70, 280, 500, 15, 0.0, 30.0);//Delay time solenoid 3
bar6 = new Scrollbar (70, 310, 500, 15, 0.0, 5.0);//Odor time solenoid 3
bar7 = new Scrollbar (70, 390, 500, 15, 0.0, 30.0);//Delay time solenoid 4
bar8 = new Scrollbar(70, 420, 500, 15, 0.0, 5.0);//Odor time solenoid 4
// bar9 = new Scrollbar(70, 500, 500, 15, 0.0, 30.0);//Delay time solenoid 5
// bar10 = new Scrollbar(70, 530, 500, 15, 0.0, 5.0);//Odor time solenoid 5

check = new Check(40, 700, 15, color(0));
AllInOrder = new Check(40,330,15, color(0));
ConstantON = new Check(40, 330, 15, color(0));

for (int i = 0; i <= 13; i++)
arduino.pinMode(i, Arduino.OUTPUT);
}

void draw() {
arduino.digitalWrite(2, Arduino.HIGH); //set output high on pin 2 for solenoid 1. This lights up an LED to indicate that the control air is flowing.
arduino.digitalWrite(4, Arduino.HIGH);
arduino.digitalWrite(6, Arduino.HIGH);
arduino.digitalWrite(8, Arduino.HIGH);
arduino.digitalWrite(10, Arduino.HIGH);
// arduino.digitalWrite(12, Arduino.LOW);
background(200);
check.display();
fill(0);
float pos1 = bar1.getPos();//displays the scroll bar value next to the scrollbar
text(nf(pos1,1,2),600,75);
float pos2 = bar2.getPos();
text(nf(pos2,1,2),600,107);
float pos3 = bar3.getPos();
text(nf(pos3,1,2),600,187);
float pos4 = bar4.getPos();
text(nf(pos4,1,2),600,220);
float pos5 = bar5.getPos();
text(nf(pos5,1,2),600,300);
float pos6 = bar6.getPos();
text(nf(pos6,1,2),600,330);
float pos7 = bar7.getPos();
text(nf(pos7,1,2),600, 410);
float pos8 = bar8.getPos();
text(nf(pos8,1,2),600,440);
// float pos9 = bar9.getPos();
// text(nf(pos9,1,2),600,518);
// float pos10 = bar10.getPos();
// text(nf(pos10,1,2),600, 548);

bar1.update(mouseX,mouseY);
bar2.update(mouseX,mouseY);
bar3.update(mouseX,mouseY);
bar4.update(mouseX,mouseY);
bar5.update(mouseX,mouseY);
bar6.update(mouseX,mouseY);
bar7.update(mouseX,mouseY);
bar8.update(mouseX,mouseY);
// bar9.update(mouseX,mouseY);
//bar10.update(mouseX,mouseY);

bar1.display();
bar2.display();
bar3.display();
bar4.display();
bar5.display();
bar6.display();
bar7.display();
bar8.display();
// bar9.display();
// bar10.display();

buttonsA[0].display();
buttonsB[0].display();
buttonsC[0].display();
buttonsD[0].display();
//buttonsE[0].display();
textAlign(CENTER,BOTTOM);
textSize(20);
fill(0,0,255);
text(“Solenoid 1”,325,50);
fill(255,0,0);
text(“Solenoid 2”,325,160);
fill(34,139,34);
text(“Solenoid 3”,325, 270);
fill(255,165,0);
text(“Solenoid 4”,325, 380);
// fill(50);
// text(“Solenoid 5”,325, 490);

fill(50);
textSize(12);
fill(50);
text("DELAY",40,75);//Solenoid 1
text("ODOR",40,105);
text("DELAY",40,185);//Solenoid 2
text("ODOR",40,215);
text("DELAY",40, 295);//Solenoid 3
text("ODOR",40, 325);
text("DELAY",40, 405);//Solenoid 4
text("ODOR",40, 435);
//text("DELAY",40,515);//Solenoid 5
//text("ODOR", 40, 545);

text("Seconds",600,50);

text("Timed",680,50);

textSize(14);
text("VENT ON/OFF", 70,700);

textSize(18);
fill(255,0,0);
text("Set the time before activating solenoid, theres no stopping it until its completed its timing.",425,625);
text("Click the Timed button to activate that Solenoid",350,650);

}

void Solenoid (float time, int pin, int pin2){
int x = int(time*1000);
arduino.digitalWrite(pin2, Arduino.LOW);
arduino.digitalWrite(pin, Arduino.HIGH);
//When any odor solonoid is open we want an LED to light up to indicate it on the bee stand so the camera can see it.
arduino.digitalWrite(11, Arduino.HIGH);//The LED light on the stand should light up
timer(x,pin);
arduino.digitalWrite(pin2, Arduino.HIGH);
arduino.digitalWrite(11, Arduino.LOW);// The LED light on the stand should go out.

}

void mousePressed(){
check.press(mouseX, mouseY);
bar1.press(mouseX, mouseY);
bar2.press(mouseX, mouseY);
bar3.press(mouseX, mouseY);
bar4.press(mouseX,mouseY);
bar5.press(mouseX,mouseY);
bar6.press(mouseX,mouseY);
bar7.press(mouseX,mouseY);
bar8.press(mouseX,mouseY);
// bar9.press(mouseX,mouseY);
// bar10.press(mouseX,mouseY);

buttonsA[0].press(mouseX, mouseY);
buttonsB[0].press(mouseX, mouseY);
buttonsC[0].press(mouseX,mouseY);
buttonsD[0].press(mouseX,mouseY);
// buttonsE[0].press(mouseX,mouseY);

boolean vent=check.checked;
if (check.checked == true) vent=true;
else vent=false;

int b = -1;
float t1 = bar1.getPos();
float t2 = bar2.getPos();

if (buttonsA[0].checked){
t1 = bar1.getPos();
t2 = bar2.getPos();
b=3;
timer(int(t1*1000),2);//wait t1 seconds before opening solenoid
Solenoid(t2,b,2);//open solenoid to allow odor out for t2 seconds
buttonsA[0].checked = false;// want to reset the radio button so that clicking anywhere won’t rerun the solenoid settings!
}

if (buttonsB[0].checked){
t1 = bar3.getPos();
t2 = bar4.getPos();
b=5;
timer(int(t1*1000),4);//wait t3 seconds before opening solenoid 2
Solenoid(t2,b,4);//open solenoid 2 to allow odor out for t4 seconds
buttonsB[0].checked = false;
}

if (buttonsC[0].checked){
t1 = bar5.getPos();
t2 = bar6.getPos();
b=7;
timer(int(t1*1000),6);//wait t3 seconds before opening solenoid 2
Solenoid(t2,b,6);//open solenoid 2 to allow odor out for t4 seconds
buttonsC[0].checked = false;
}

if (buttonsD[0].checked){
t1 = bar7.getPos();
t2 = bar8.getPos();
b=9;
timer(int(t1*1000),8);//wait t3 seconds before opening solenoid 2
Solenoid(t2,b,8);//open solenoid 2 to allow odor out for t4 seconds
buttonsD[0].checked = false;
}

//if (buttonsE[0].checked){//The fifth set of bars don’t do anything, they are there for future expansion.
// t1 = bar9.getPos();// I’ve stolen pin 11 from the Arduino to power the red indicator LED on the bee stand.
// t2 = bar10.getPos(); // This bit of code doesnt realy serve a purpose but I’m too lazy to remove it and fix all the downstream error that would cause.
// b=11;
// timer(int(t1*1000),10);//wait t3 seconds before opening solenoid 2
// Solenoid(t2,b,10);//open solenoid 2 to allow odor out for t4 seconds
// buttonsE[0].checked = false;
// }

if(vent){
arduino.digitalWrite(12, Arduino.LOW);
arduino.digitalWrite(13, Arduino.HIGH);
}
if(!vent){
arduino.digitalWrite(12,Arduino.HIGH);
arduino.digitalWrite(13, Arduino.LOW);
}
}

void mouseReleased(){
bar1.release();//without this the bar will continue to move after you release the mouse button
bar2.release();
bar3.release();
bar4.release();
bar5.release();
bar6.release();
bar7.release();
bar8.release();
// bar9.release();
// bar10.release();

}

void timer(int x, int pin){
delay(x);
arduino.digitalWrite(pin, arduino.LOW);
}