Processing has 2 modes, one which just a single run through in which you can use functions/methods outside of functions, and the other in which you have setup and draw and so have multiple loops through, but in which you can't due to restrictions within Java.
So the reason you're getting the error, is that you're setting values from functions/methods outside of a function and so you can't use setup/draw method.
To fix it, you'll need to move he initialization of the values to within setup.
Code:/ Import traer physics engine
import traer.physics.*;
// Make variables
int firstballx, firstbally, secondballx, secondbally;
ParticleSystem sys;
Particle firstBall;
Particle secondBall;
Spring tether;
// Set up the program
void setup()
{
size(500, 600); // Set size to 500x600
firstballx = int(firstBall.position().x());
firstbally = int(firstBall.position().y());
secondballx = int(secondBall.position().x());
secondbally = int(secondBall.position().y());
sys = new ParticleSystem(0.0, 1.0);
firstBall = sys.makeParticle(4.0, 150.0, 300.0, 1.0);
secondBall = sys.makeParticle(4.0, 350.0, 300.0, 1.0);
tether = sys.makeSpring(firstBall, secondBall, 4.0, 1.0, 80.0);
fill(0, 0, 0);
}
void draw()
{
sys.tick();
background(255, 255, 255);
line(firstballx, firstbally, secondballx, secondbally);
ellipse(firstballx, firstbally, 40, 40);
ellipse(secondballx, secondbally, 40, 40);
}