- #1
SolarMidnite
- 22
- 0
Hello,
I am currently enrolled in an introductory Computer Science course, and I've been having trouble with a Java/HTML project. I have been given the following code for a triangle applet to be linked in an HTML page I have to make:
import java.awt.*;
import java.applet.Applet;
public class Triangle extends Applet {
public void paint (Graphics g){
int bottomX=80;
int bottomY=200;
int base=100;
int height=100;
g.drawLine(bottomX,bottomY,bottomX+base,bottomY);
g.drawLine(bottomX+base,bottomY,bottomX+base/2,bottomY-height);
g.drawLine(bottomX+base/2,bottomY-height, bottomX,bottomY);
}
}
I've searched for solutions on the Web but have not figured out how to resolve the following error on the DOS command prompt:
Exception in thread "main" java.lang.NoSuchMethodError: main
I have been able to compile the Triangle.java file using the command: javac Triangle.java but when I enter: java Triangle, I get the above error. When I tested it using the appletviewer, the class was not found. I am currently using Windows 7 and have the Java SE Development Kit 6 Update 32 installed. I would really appreciate any input as I don't know what I'm doing wrong.
I am currently enrolled in an introductory Computer Science course, and I've been having trouble with a Java/HTML project. I have been given the following code for a triangle applet to be linked in an HTML page I have to make:
import java.awt.*;
import java.applet.Applet;
public class Triangle extends Applet {
public void paint (Graphics g){
int bottomX=80;
int bottomY=200;
int base=100;
int height=100;
g.drawLine(bottomX,bottomY,bottomX+base,bottomY);
g.drawLine(bottomX+base,bottomY,bottomX+base/2,bottomY-height);
g.drawLine(bottomX+base/2,bottomY-height, bottomX,bottomY);
}
}
I've searched for solutions on the Web but have not figured out how to resolve the following error on the DOS command prompt:
Exception in thread "main" java.lang.NoSuchMethodError: main
I have been able to compile the Triangle.java file using the command: javac Triangle.java but when I enter: java Triangle, I get the above error. When I tested it using the appletviewer, the class was not found. I am currently using Windows 7 and have the Java SE Development Kit 6 Update 32 installed. I would really appreciate any input as I don't know what I'm doing wrong.