We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Applet start failed: class not found
Page Index Toggle Pages: 1
Applet start failed: class not found (Read 691 times)
Applet start failed: class not found
Dec 19th, 2007, 10:33pm
 
Please help. I'm getting "class not found: sketch_071219a"

I can't find the string "class not found" anywhere in the forum, and googling isn't helping much because I'm pretty new to java.

[EDIT: I'm using Processing 0135 Beta]
Re: Applet start failed: class not found
Reply #1 - Dec 19th, 2007, 10:57pm
 
I believe this error occurs when you call a user defined class that isn't defined in your code.

If you could post the code, we could help more.
Re: Applet start failed: class not found
Reply #2 - Dec 19th, 2007, 11:01pm
 
import processing.opengl.*;

float rotx = PI/4;
float roty = PI/4;
ToroidParams toroid;
PFont f;
boolean play = false;
int lastmillis = 0;
int time = 0;

void setup()
{
 lastmillis = millis();
 size(640, 480, P3D);
 fill(255);
 noStroke();
 f = loadFont("Verdana-10.vlw");
 textFont(f,10);
 
 toroid = new ToroidParams();
 toroid.isHelix = true;
}

void draw()
{
 background(0);
 lights();
 pushMatrix();
 translate(width/2.0, height/2.0, -100);
 rotateX(rotx);
 rotateY(roty);
 //scale(1);
 Toroid(toroid);
 popMatrix();
 int dTime = millis()-lastmillis;
 lastmillis += dTime;
 if ( play )
 {
   time += dTime;
 }
 text((play?"playing (":"paused (") + Integer.toString(time) + ")",32,height-32);
}

class Point3D
{
 float x, y, z;

 // constructors
 Point3D()
 {
 }

 Point3D(float x, float y, float z)
 {
   this.x = x;
   this.y = y;
   this.z = z;
 }
}

class ToroidParams
{
 public int pts;
 public float radius;
 public int segments;
 public float latheRadius;
 public boolean isHelix;
 public float helixOffset;
 
 public ToroidParams()
 {
   pts = 40;
   radius = 40;
   segments = 60;
   latheRadius = 100;
   isHelix = false;
   helixOffset = 5;
 }
};

void Toroid(ToroidParams p)
{
 Point3D vertices[], vertices2[];
 
 // initialize point arrays
 vertices = new Point3D[p.pts+1];
 vertices2 = new Point3D[p.pts+1];

 // fill arrays
 float angle = 0;
 for(int i=0; i<=p.pts; i++)
 {
   vertices[i] = new Point3D();
   vertices2[i] = new Point3D();
   vertices[i].x = p.latheRadius + sin(radians(angle))*p.radius;
   if (p.isHelix)
   {
     vertices[i].z = cos(radians(angle))*p.radius-(p.helixOffset*
       p.segments)/2;
   }
   else
   {
     vertices[i].z = cos(radians(angle))*p.radius;
   }
   angle+=360.0/p.pts;
 }

 // draw toroid
 float latheAngle = 0;
 for(int i=0; i<=p.segments; i++)
 {
   beginShape(QUAD_STRIP);
   for(int j=0; j<=p.pts; j++)
   {
     if (i>0)
     {
       vertex(vertices2[j].x, vertices2[j].y, vertices2[j].z);
     }
     vertices2[j].x = cos(radians(latheAngle))*vertices[j].x;
     vertices2[j].y = sin(radians(latheAngle))*vertices[j].x;
     vertices2[j].z = vertices[j].z;
     // optional helix offset
     if (p.isHelix)
     {
       vertices[j].z+=p.helixOffset;
     }
     vertex(vertices2[j].x, vertices2[j].y, vertices2[j].z);
   }
   // create extra rotation for helix
   if (p.isHelix)
   {
     latheAngle+=720.0/p.segments;
   }
   else
   {
     latheAngle+=360.0/p.segments;
   }
   endShape();
 }
}

/*
left/right arrow keys control ellipse detail
up/down arrow keys control segment detail.
'a','s' keys control lathe radius
'z','x' keys control ellipse radius
'w' key toggles between wireframe and solid
'h' key toggles between toroid and helix
*/
void keyPressed()
{
 if(key == CODED)
 {
   // pts
   if (keyCode == UP)
   {
     if (toroid.pts<40)
     {
       toroid.pts++;
     }
   }
   else if (keyCode == DOWN)
   {
     if (toroid.pts>3)
     {
       toroid.pts--;
     }
   }
   // extrusion length
   if (keyCode == LEFT)
   {
     if (toroid.segments>3)
     {
       toroid.segments--;
     }
   }
   else if (keyCode == RIGHT)
   {
     if (toroid.segments<80)
     {
       toroid.segments++;
     }
   }
 }
 // lathe radius
 if ( key == ' ' )
 {
   play = !play;
 }
 if (key =='a')
 {
   if (toroid.latheRadius>0)
   {
     toroid.latheRadius--;
   }
 }
 else if (key == 's')
 {
   toroid.latheRadius++;
 }
 // ellipse radius
 if (key =='z')
 {
   if (toroid.radius>10)
   {
     toroid.radius--;
   }
 }
 else if (key == 'x')
 {
   toroid.radius++;
 }
 // wireframe
 /*if (key =='w')
 {
   isWireFrame = !isWireFrame;
 }*/
 // helix
 if (key =='h')
 {
   toroid.isHelix = !toroid.isHelix;
 }
}

void mouseDragged()
{
 float rate = 0.01;
 rotx += (pmouseY-mouseY) * rate;
 roty += (mouseX-pmouseX) * rate;
}
Re: Applet start failed: class not found
Reply #3 - Dec 19th, 2007, 11:02pm
 
FYI, I have figured out this much...

If I change from OPENGL to P3D, it loads.

However, I don't get any output and the font looks terrible Sad

[EDIT: the version I pasted above already has P3D - change to OPENGL and it won't load]
Re: Applet start failed: class not found
Reply #4 - Dec 19th, 2007, 11:54pm
 
Everything works fine on my computer in P3D and in OPENGL.

Are you doing anything else in the script... that you didn't paste?
Re: Applet start failed: class not found
Reply #5 - Dec 20th, 2007, 12:15am
 
nope

They both work fine in Processing, I'm only having the problems when exporting to an applet.
Re: Applet start failed: class not found
Reply #6 - Dec 20th, 2007, 7:43am
 
I can export and run the applet in P3D and OPENGL without having any error.

I must say, I don't understand how come it reacts differently.
Sorry I wasn't much help. Sad
Re: Applet start failed: class not found
Reply #7 - Dec 20th, 2007, 11:49pm
 
FYI, I updated to the lastest version of Java (1.6) and it works now.
Page Index Toggle Pages: 1