0

I'm running into Main method not found in class Raytracer, please define the main method as: public static void main(String[] args).

But when I do that, I get a bunch of non-static method cannot be referenced from a static context (and no matter how much statics I append, I'm still stuck unable to run the program).

What should I do?

dcheng
  • 1,827
  • 1
  • 11
  • 20

1 Answers1

0

Call the constructor for your Main class, and start your code from there. When your static main method is running, your Main class has not been instantiated yet, so you can only reference static members at that point.

public class Main {

    public static void main(String args[]) {
        new Main();
    }

    Main() {
        //do stuff
    }

}
Luigi Cortese
  • 10,841
  • 6
  • 37
  • 48