NetBeans 7.1
Let's say I want to run this simple HelloWorld code from wikipedia:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import java.applet.Applet; import java.awt.*; public class HelloWorld extends Applet { public void init() { } public void stop() { } public void paint(Graphics g) { g.drawString("Hello, world!", 20,10); g.drawArc(40,30,20,20,0,360); } } |
I click:
- NewProject/Java/JavaApplication
- Set project name to: "AppletHelloWorld", Finish
- click on AppletHelloWorld.java, I see this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| package applethelloworld;
public class AppletHelloWorld {
public static void main(String[] args) { } }
|
- I copy/past the code and change "public class HelloWorld extends Applet" to "public class AppletHelloWorld extends Applet"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| import java.applet.Applet; import java.awt.*; public class AppletHelloWorld extends Applet { public void init() { } public void stop() { } public void paint(Graphics g) { g.drawString("Hello, world!", 20,10); g.drawArc(40,30,20,20,0,360); } } |
- click Run, "BUILD SUCCESSFUL (total time: 0 seconds)", nothing appears on the screen
- Click "Clean and Build Main Project", click Run again, get an error "applethelloworld.AppletHelloWorld class wasn't found in AppletHelloWorld project; select the main class".
I guess, I clicked something wrong along the way

I was checking several tutorials but I always stumbled on some differences (like there is no "Run as Applet" option in NetBeans 7.1 or the option they select in the tutorial does not exist)