-1

I'm getting this error saying that I haven't defined a main method when trying to run my programme from the terminal. I have defined a main method as below and it runs fine in the IDE, so I'm not sure why it is throwing this error:

Error: Main method not found in class Quarterly_Report, please define the main method as:
   *public static void main(String[] args)
or a JavaFX application class must extend javafx.application.Application*

This is the code:

public class Quarterly_Report{

    public static void main(String[] args){
         Department kitchen = new Department("Kitchen", 0, 0, 0, 65000, 67000, 56000, 45000, 56000, 72000, 0, 0, 0);
         Department electrical = new Department("Electrical", 0, 0, 0, 67000, 63000, 78000, 78000, 104000, 103000, 0, 0, 0);
         Department bathroom = new Department("Bathroom", 0, 0, 0, 63000, 63000, 65000, 71000, 73000, 69000, 0, 0, 0);
         Department softFurnish = new Department("Soft Furnishings", 0, 0, 0, 18000, 24000, 22000, 19000, 17000, 16000, 0, 0, 0);
         Department accesories = new Department("Accesories", 0, 0, 0, 16000, 23000, 21000, 19000, 20000, 19000, 0, 0, 0);
        ReportMethods report = new ReportMethods();
        report.departments.add(kitchen);
        report.departments.add(bathroom);
        report.departments.add(electrical);
        report.departments.add(softFurnish);
        report.departments.add(accesories);
        report.chooseQuart();
        
        }

}

I tried compiling and running this from the terminal, but it is just throwing an error.

It runs fine in the IDE I'm using, so not sure what the issue is!

Olivia
  • 1

1 Answers1

0

First of all we should know how you are compiling your java project, there are lots of ways, via Maven, Ant, Gradle, via terminal, with your IDE etc...

Also what is the output you are getting .jar or .java?

What command are you using to run the code? java -jar yourcompiled.jar

May this guide can help you: How to create a .jar file using the terminal