Error: Main method not found in class StdDraw, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application
I'm getting the above error when I run the program:
public class Lineage {
public static void main(String args[]) {
//Task1 Wk2
StdDraw.setScale(0, 512);
StdDraw.line(0, 500, 0, 10);
StdDraw.line(0, 500, 0.5, 10);
StdDraw.line(0, 500, 1, 10);
StdDraw.line(0, 500, 2, 10);
StdDraw.line(0, 500, 5, 10);
StdDraw.line(0, 500, 10, 10);
}
/*public static void drawlines(double M, double C) {
//algorithm for line increment
double Y;//declares value for Y-axis
StdDraw.setScale(1, 512);//sets scale
for(double xi=1; xi<512; xi++) {
Y = (M*xi) + C;
StdDraw.point(xi, Math.round(Y));
}
}*/
}
I know it's a compiler error of some sort but don't understand why because my previous tasks have all been using the same reference folder StdDraw.jar which has a "final" class and compiles perfectly fine in all other projects. Not only that but the way I was taught is that the main method is the point of entry on runtime, so, if I have one here in my program (above) why am I being asked to provide one in a reference folder? I'm confused.
I'm unsure how to get my program to compile properly, I've tried extending the StDDraw class in the main class but is causing more errors. I've tried researching but can't seem to find a solution to this likely, very simple issue. I'm operating in Eclipse Juno and if requested I can post the StdDraw class but it's massive.
Edit: I tried to edit the reference class and include a main method of some kind but I literally am unable to make changes to the file.
Error: Main method not found in class StdDraw
Means 1) it's missing a main method and 2) you currently have the project in eclipse setup to run the StdDraw class.
Try right-clicking on your Lineage class in the left pane (or where the files view is open) and choose "Run as > Java application" (can't remember exactly what it says)