[solved]Applet Troubles..."Error: Class not found: "

I guess JVM cannot find my main class?

Even though when making my .Jar file, in Eclipse, I select my main class?

Any idea’s whats going on?

Edit: It says “Can not fin artLabApplet.class”
When I opened the .jar and the manifest file says it’s there, and it is in the .jar…???

Edit #2: I’ve tried every single option I’ve tried adding a Main function to the file I want to be the “main”, I’ve tried everything I could think of. Any ideas would be reallly beneficial. Hour 6 so far on getting a working applet onto the web…

I am starting to lose my cool…
here’s my applet code:


<applet code="org.jdesktop.applet.util.JNLPAppletLauncher" width=480 height=320
      archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,
               http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,
               http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,
               http://caseykneale.000space.com/gallery2.jar">
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="ArtLabAppletLaunch">
   <param name="subapplet.displayname" value="ArtLab - Casey Kneale">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp">
</applet>

Here’s the .jar
http://www.caseykneale.000space.com/gallery2.jar

I checked a working .jar file of mine’s manifest that is NOT the issue. I’m clueless. I did the same thing twice and got two very different results…

I just downloaded net-beans and had the same exact results. What is going on? Until I figure this out there is no point in even programming with Java.

Keep cool. Compare what you did with the way that “JOGL gears” applet is deployed. You can use JOGL without Netbeans too. Do you still need some help? Don’t give up.

It could be the old Carriage Return in your manifest file issue (which can cause Class not found, its bloody annoying, had me once)… I cant remember what it was exactly (try googling carriage return in manifest). I think your last line may need a Carriage Return or something like that…
Try opening your 2 manifest files (the working one and the broken one) with a text editor and show the End of line character (you can do this in notepad++ and ultraedit, should be possible in any decent text editor) and compare.
If its not this then dunno (your link to you .jar file did not work, so couldnt check).

Sorry about the link being broken. I’ve tried creating new projects with different names which changed my export .jar name (over and over).

here’s the updated link and applet code:
http://www.caseykneale.000space.com/ArtLaboratory.jar

Here’s my Applet Code(HTML)


<applet code="org.jdesktop.applet.util.JNLPAppletLauncher" width=480 height=320
      archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,
               http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,
               http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,
               http://caseykneale.000space.com/ArtLaboratory.jar">
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="ArtLabAppletLaunch">
   <param name="subapplet.displayname" value="ArtLab - Casey Kneale">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp">
</applet>

Steveyo I’ll look into that… I don’t see why Eclipse and Net-Beans would both build un-working manifest files though?

Someone said that the Jar file was corrupted?

I’m not sure exactly what you mean gouessej. The Applet runs perfectly fine in the IDE(which is good).

I just rebuilt an old project into a new .Jar and it works perfectly fine. The code is very similar… I’m wondering if I have like class-path errors with perhaps how I imported my “Media” folder to my project. Blah.

Is there a different way to deploy Multi-Class applet’s without using a .jar? At this point I don’t care if things are practical I just really want to be able to show my professor some side-projects of mine so I can convince him to be a computer science tutor.

Thanks for replying.

The new link is also broken, so I couldn’t test it.

The link is broken for some reason but if you copy and paste the URL in it will work. I don’t know why it’s doing that…

Ok, I got the jar by pasting the URL directly, but the jar file is corrupted. I tried with the previous link (gallery2.jar) and it is also corrupted.

Why could it corrupted?
How can I get it to not be corrupted?

It may have something to do with you web host.

Can you upload the jar somewhere else? (like http://www.filedropper.com/ for instance)

http://www.filedropper.com/artlabplz

that’s the link for download.

Ok, it seems that your host was mangling the jar file somehow. I got the ArtLabAppletLaunch to start up using the following:

<applet code="org.jdesktop.applet.util.JNLPAppletLauncher" width=480 height=320
      archive="http://download.java.net/media/applet-launcher/applet-launcher.jar,
               http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jar,
               http://download.java.net/media/gluegen/webstart/gluegen-rt.jar,
               http://hsaka.webs.com/ArtLabPlz.jar">
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="ArtLabAppletLaunch">
   <param name="subapplet.displayname" value="ArtLab - Casey Kneale">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1" value="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp">
</applet>

However, there seems to be some problem with gluegen. Specifically this exception:

Exception in thread "AWT-EventQueue-6" java.lang.NoClassDefFoundError: com/sun/gluegen/runtime/DynamicLookupHelper
	at ArtLab.<init>(ArtLab.java:17)
	at ArtLabAppletLaunch.<init>(ArtLabAppletLaunch.java:23)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at org.jdesktop.applet.util.JNLPAppletLauncher.startSubApplet(JNLPAppletLauncher.java:1914)
	at org.jdesktop.applet.util.JNLPAppletLauncher.access$200(JNLPAppletLauncher.java:658)
	at org.jdesktop.applet.util.JNLPAppletLauncher$5.run(JNLPAppletLauncher.java:1269)
	at java.awt.event.InvocationEvent.dispatch(Unknown Source)
	at java.awt.EventQueue.dispatchEvent(Unknown Source)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
	at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.sun.gluegen.runtime.DynamicLookupHelper
	at java.net.URLClassLoader$1.run(Unknown Source)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClass(Unknown Source)
	at java.lang.ClassLoader.loadClassInternal(Unknown Source)
	... 19 more

Interesting… Thanks for helping me through this!

GluGen…

it was built using java 1.6 (if that makes a difference?).

The application runs perfectly fine in IDE(not even a warning).

I copied the Applet code you made (using your host) into my host and it’s still just giving me the class not found error. This is screwing with my head. If I posted code do you think it’d help you understand what may be going on?

Applet Launch Class


//Imports up here
public class ArtLabAppletLaunch extends Applet implements ActionListener {
	private static final long serialVersionUID = 1L;
	
	protected GLCanvas canvas;
	protected Animator animator;
	//Listener's/Handlers for input
	private KeyboardHandler keyboardHandler = new KeyboardHandler();
	//GUI for Applet
	private TextArea descriptionTxt = new TextArea(); 
	private Button backToGalleryBtn = new Button();
	//Load Canvas stuff?
	private ArtLab artLabProcess = new ArtLab(this);
	//GUI
	private Panel movePnl = new Panel();
	private Label[] controlLbl = new Label[5];
	private Button scaleHeightPlusBtn = new Button();
	private Button scaleHeightLessBtn = new Button();
	private Button scaleWidthPlusBtn = new Button();
	private Button scaleWidthLessBtn = new Button();
	private Button zoomInBtn = new Button();
	private Button zoomOutBtn = new Button();
	private Button resetBtn = new Button();
	
	public void addKeyListener(KeyboardListenerInterface listener){
        keyboardHandler.addListener(listener);
	}
	
	public void changeText(String text){
		descriptionTxt.setText(text);
	}
	
	public void setGalleryGUIVisibility(boolean visible){
		backToGalleryBtn.setVisible(visible);
		movePnl.setVisible(visible);
	}
	
	public void init() {
		//setSize(512, 256 + 128 + 32 + 128); this is commented out
		setLayout(new BorderLayout());
		GLCapabilities glCapabilities = new GLCapabilities();
		
		glCapabilities.setDoubleBuffered(true);
		glCapabilities.setHardwareAccelerated(true);

		canvas = new GLCanvas(glCapabilities);
		
		setLayout(null);
		
		animator = new Animator(canvas);
		
		canvas.addGLEventListener(keyboardHandler);
        canvas.addKeyListener(keyboardHandler);
        
		canvas.addGLEventListener(artLabProcess);
		
		canvas.setBounds(0, 0, 512, 256);
		
		backToGalleryBtn.setBounds(0, 384, 512, 32); 
		backToGalleryBtn.setLabel("~ Go Back To The Art Gallery ~"); 
		backToGalleryBtn.setVisible(false);
		
		descriptionTxt.setBounds(0, 256, 512, 128);
		//GUI PANEL for looking Directions
		movePnl.setVisible(false);
		movePnl.setBounds(0, 417, 512, 128);
		movePnl.setLayout(null);
			controlLbl[0] = new Label();
			controlLbl[0].setBounds(0, 0, 64, 32);
			controlLbl[0].setText("Height: ");
			movePnl.add(controlLbl[0]);
				scaleHeightPlusBtn.setBounds(64, 0, 32, 32);
				scaleHeightPlusBtn.setLabel("+");
				movePnl.add(scaleHeightPlusBtn);
				
				scaleHeightLessBtn.setBounds(128, 0, 32, 32);
				scaleHeightLessBtn.setLabel("-");
				movePnl.add(scaleHeightLessBtn);
			//More boring GUI adding code
				
		//Add All GUI to Applet
		add(canvas);
		add(descriptionTxt);
		//more GUI added here
		
		//Add Event Listeners for all GUI
		backToGalleryBtn.addActionListener(this);
		//More of those
	}
	
	public void start() {
		animator.setRunAsFastAsPossible(false);
		animator.start();
	}

	public void stop() {
		animator.stop();
	}
	
	public void actionPerformed(ActionEvent unknownEvent){
		//Handles GUI actions
	}
}

Actual Applet Code:


public class ArtLab implements GLEventListener{
	private float LOOK_AT_DIST = 100.0f;
	private final static float FOV = 45.0f;
	private final static float DEFAULT_ART_SIZE = 10.0f;
	private final static float CAMERA_MOVEMENT_INCREMENT = 0.2f;
	private GL gl;
	private GLU glu = new GLU();
	
	//Camera Points
	private Point3D CameraLook = new Point3D(0.0f, 1.0f, 0.0f);
	private Point3D Camera = new Point3D(5.0f, 5.0f, 10.0f,  0,270,0);

	private Point3D standAloneCamera = standAloneCameraReset;
	
	//Gallery Objects
	private LinkedList <Plane> walls = new LinkedList <Plane> ();
	private Plane floor = null;
	private Plane ceiling = null;
	private LinkedList <Art> artThumbNails = new LinkedList <Art> ();
	
	//Stand-alone art Object
	private Art standAlone = null;
	
	//Huds
	private HeadsUpDisplay cursor = new HeadsUpDisplay(0.50f, 0.50f, 0.064f, 0.128f);
	
	//Display Lists
	private int room;
	private int art;
	
	//TOP
	private ArtLabAppletLaunch artLabTOP;

	//Application Variables
	private int lastSelectedImage = -1, galleryImage = -1;
	private boolean inGallery = true;
	private boolean hasResetCamera = false;
	
	public ArtLab(ArtLabAppletLaunch cg) { 
	    cg.addKeyListener(new KeyboardListenerInterface() {
	    	public void buttonPressed(int i){handleKeyboardInput(i);}
	    });
	    
	    artLabTOP = cg;
	} 
	
	public void init(GLAutoDrawable drawable) {
	    gl = drawable.getGL(); //Set Up GL
	    gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);//Black GL clear color
	    gl.glEnable(GL.GL_DEPTH_TEST);
	    gl.glClearDepth(1.0f);
	    gl.glDepthFunc(GL.GL_LEQUAL);
	    gl.glHint(GL.GL_PERSPECTIVE_CORRECTION_HINT, GL.GL_NICEST);
	    
	    //Initialize Camera
	    updateCamera();
	    
	    //Create Room Environment
	    walls.add(new Plane(15f, 5.0f, 0f,
				30.0f, 10.0f, 0.0f));
	    walls.add(new Plane(15f, 5.0f, 30f,
				30.0f, 10.0f, 0.0f));
	    walls.add(new Plane(0f, 5.0f, 15f,
				0.0f, 10.0f, 30.0f));
	    walls.add(new Plane(30f, 5.0f, 15f,
				0.0f, 10.0f, 30.0f));
	    floor = new Plane(15f, 0.0f, 15f,
				30.0f, 0.0f, 30.0f);
	    ceiling = new Plane(15f, 10.0f, 15f,
				30.0f, 0.0f, 30.0f);
	    
	    //Create Paintings
	    artThumbNails.add(new Art(15f, 5.0f, 0.2f,
				5.0f, 4.5f, 0.0f));
	    //etc
	    
	    //Create Stand-Alone Art
	    standAlone = new Art(0.0f, 5.0f, 0f,
				5.0f, 5.0f, 0.0f);
	    
	    //Load Images

	    //Load Textures From Images
	    
	    //Create Display List's
	    room = gl.glGenLists(1);
	    art = gl.glGenLists(2);
	    
	    //Populate Room Display List
	    gl.glNewList(room, GL.GL_COMPILE);
	    	//Draw Walls
		    for(int index = 0; index < walls.size(); index++){
		    	gl.glPushMatrix();
		    		gl.glTranslatef(walls.get(index).X, walls.get(index).Y, walls.get(index).Z);
		    		walls.get(index).draw(gl);
		    	gl.glPopMatrix();
		    }
			//Draw Floor
			gl.glPushMatrix();
				gl.glTranslatef(floor.X, floor.Y, floor.Z);
				floor.draw(gl);
			gl.glPopMatrix();
			//Draw Ceiling
			gl.glPushMatrix();
				gl.glTranslatef(ceiling.X, ceiling.Y, ceiling.Z);
				ceiling.draw(gl);
			gl.glPopMatrix();
	    gl.glEndList();
	    
	  //Populate Art Display List
	    gl.glNewList(art, GL.GL_COMPILE);
    	//Draw Art in Canvas's
		    for(int index = 0; index < artThumbNails.size(); index++){
		    	gl.glPushMatrix();
		    		gl.glTranslatef(artThumbNails.get(index).X, artThumbNails.get(index).Y,artThumbNails.get(index).Z);
		    		artThumbNails.get(index).draw(gl);
		    	gl.glPopMatrix();
		    }
	    gl.glEndList();
    } 
	
	public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
		GL gl = drawable.getGL();
		if (height == 0){height = 1;} //Avoid Division by Zero Error
		
		gl.glViewport(x, y, width, height);
		gl.glMatrixMode(GL.GL_PROJECTION);
		gl.glLoadIdentity();
		glu.gluPerspective(FOV, (float)width/(float)height, 1, LOOK_AT_DIST); 

		gl.glMatrixMode(GL.GL_MODELVIEW);
		gl.glLoadIdentity();
	}
	
	public void display(GLAutoDrawable drawable) {
		GL gl = drawable.getGL();
		gl.glClear(GL.GL_COLOR_BUFFER_BIT | GL.GL_DEPTH_BUFFER_BIT);
		gl.glLoadIdentity();

		if(inGallery){
			//Use In Gallery Camera
			glu.gluLookAt(Camera.X, Camera.Y, Camera.Z,
					CameraLook.X, CameraLook.Y, CameraLook.Z, 0,1,0); 
			//Environment
			gl.glCallList(room);
			gl.glCallList(art);
			//Heads Up Displays
			begin2D();
				gl.glPushMatrix();
					cursor.draw(gl);
				gl.glPopMatrix();
			end2D();
		} else {
			//Use Solo Art Viewing Camera
			glu.gluLookAt(standAloneCamera.X, standAloneCamera.Y, standAloneCamera.Z,
					CameraLook.X, CameraLook.Y, CameraLook.Z, 0,1,0);
			//Environment for Viewing Single Art-work
			gl.glPushMatrix();
				gl.glTranslatef(standAlone.X, standAlone.Y, standAlone.Z);
				standAlone.drawBigArt(gl);
			gl.glPopMatrix();
		}
		
	    gl.glFlush();
	}
	
    private void begin2D() {
        gl.glMatrixMode(GL.GL_PROJECTION);        
        gl.glPushMatrix();        
        	gl.glLoadIdentity();        
        	gl.glOrtho(0.0f, 0.0f, 1.0f, 1.0f, -1.0f, 1.0f);        
        	gl.glMatrixMode(GL.GL_MODELVIEW);        
        		gl.glPushMatrix();        
        			gl.glLoadIdentity();        
        			gl.glDisable(GL.GL_DEPTH_TEST);        
        			gl.glDisable(GL.GL_LIGHTING);
    }
    
    private void end2D() {
    				gl.glEnable(GL.GL_LIGHTING);
    				gl.glEnable(GL.GL_DEPTH_TEST);
    				gl.glMatrixMode(GL.GL_PROJECTION);
    			gl.glPopMatrix();
    		gl.glMatrixMode(GL.GL_MODELVIEW);
        gl.glPopMatrix(); 
    }
	
}

Do Display Lists work in Applets?

Yes they do.

Okay I recently found out… I can’t upload any files anywhere? :persecutioncomplex:
Literally I cannot complete Instant Messenger Transfers, FTP Uploads. I’m googling around right now trying to figure out why(turning off my fire-wall did nothing). I’m not sure if this is the root of my problem, but it sounds like it certainly isn’t helping…

Edit: Fixed the virus and the problem. Still can’t make .Jar’s…

Is anyone on here nice enough to build me the freaking .jar if I send them all the code + media and everything? Seriously this is reallly frustrating, and after this I’m switching over to C.

Which IDE are you using?

Upload the files somewhere. I’ll try to build it for you.

I’m using eclipse but if that’s an issue I could build it in NetBeans.

heres the zip:

www.caseykneale.000space.com/ArtLabGallery.zip

Thanks so much for trying.

Here you go:
http://hsaka.webs.com/ArtLabGallery.jar