   [java] need help, it's been  a long time since i've used java
  It's been a while since i've coded anything in Java, so I need your help.I got this tutorial on applets at http://java.sun.com/docs/books/tutorial/applet/overview/index.htmlimport java.applet.Applet;import java.awt.Graphics;public class yves extends Applet {    StringBuffer buffer;    public void init() {buffer = new StringBuffer();   addItem("initializing... ");    }    public void start() {   addItem("starting... ");    }    public void stop() {   addItem("stopping... ");    }    public void destroy() {   addItem("preparing for unloading...");    }    void addItem(String newWord) {   System.out.println(newWord);   buffer.append(newWord);   repaint();    }    public void paint(Graphics g) {//Draw a Rectangle around the applet's display area.   g.drawRect(0, 0, size().width - 1, size().height - 1);//Draw the current string inside the rectangle.   g.drawString(buffer.toString(), 5, 15);    }}Tried that exact peice of code and got this error:Exception in thread "main" java.lang.NoClassDefFoundError: yvesPress any key to continue...I'm using the latest version of the SDK   
Quote:Original post by yves032784It's been a while since i've coded anything in Java, so I need your help.I got this tutorial on applets at http://java.sun.com/docs/books/tutorial/applet/overview/index.html*** Source Snippet Removed ***Tried that exact peice of code and got this error:Exception in thread "main" java.lang.NoClassDefFoundError: yvesPress any key to continue...I'm using the latest version of the SDKLooks like you're trying to write an application (run from the command line) instead of an applet (which has to be embedded in a web page) take a look at this trail first:http://java.sun.com/docs/books/tutorial/getStarted/application/index.htmlthen to write GUI applications, the 'ole swing trail is the place to go:http://java.sun.com/docs/books/tutorial/uiswing/index.htmlD.;Quote:Original post by daireqLooks like you're trying to write an application (run from the command line) instead of an applet (which has to be embedded in a web page) Applets don't need to be in a webpage, I use applets all the time for simple sound managers...;  However, to run the class above the op (original poster) would have to either put it in a webpage or use appletviewer (as this is a newbie question I doubt if its an applet in an application...).  The error says to me either 1) the op isn't specifying the path correctly or 2) if it IS in a webpage then he may not have a 1.4+ version of the jre setup as the plugin.Need more info op, how are you running the applet?   ;  Where is located the wrongly named yves.class? You should use capital leters for class names.Try to write application first, browsers are BAD company.Of course if you have set classpath to some value, you should have "-cp .", or is it "-cp.", in the command line.