1
package javaapp;

import javax.swing.JApplet;
import java.awt.Graphics;

public class JavaApp extends JApplet
{
    public void paint(Graphics canvas) 
    {
        canvas.drawOval(100, 50, 200, 200);
        canvas.fillOval(155, 100, 10, 20);
        canvas.fillOval(230, 100, 10, 20);
        canvas.drawArc(150, 160, 100, 50, 180, 180);
    }
}

I tried to run this code which draws a smiley face on a canvas. I ran this code also on Eclipse, where it compiled fine. But on NetBeans, it keeps saying it can't find the main class. Is NetBeans recommended for a beginner like me or should I look for another IDE that better suits for a beginner? I am more fond with the NetBeans because the interface seems more friendly.

user3000482
  • 185
  • 1
  • 2
  • 8

2 Answers2

1

In netbeans, right click on the project and chose properties. Under Application > Webstart, there is an option Applet class. specify the full path to your main class (i.e with package names).

dhaval joshi
  • 490
  • 1
  • 3
  • 15
0

Right click the project node and choose 'run' from the list. Don't right click the file (run file) as this doesn't work in NetBeans.