-1

I am completely new to Java/Eclipse and i am trying to run this code but the message below continues to populate in the console. Any help is appreciated.

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

enter image description here

  • 1
    You should learn the basics of the language , you cannot run a class doesn't contains a main method – Oussama ZAGHDOUD Apr 16 '22 at 00:29
  • 1
    The error message is pretty telling. Not much more can be added there. https://www.journaldev.com/12552/public-static-void-main-string-args-java-main-method#:~:text=Java%20main%20method%20is%20the,args%20or%20String%20args%5B%5D%20., https://docs.oracle.com/javafx/2/get_started/hello_world.htm#:~:text=A%20JavaFX%20application%20defines%20the,in%20a%20given%20pixel%20size. – Csisanyi Apr 16 '22 at 00:30

2 Answers2

0

Your code has no main method, which is what the compiler is searching to compile from.

  • What do you suggest i add? I am completely new to this. – cipher Apr 16 '22 at 00:45
  • I suggest that you 1) do a basic tutorial on how to write and run a Java "hello world" program, 2) Google the error message before asking, and 3) read the duplink above ... which you can find by Googling and following the links – Stephen C Apr 16 '22 at 00:47
0

Hello @cipher welcome to the java community, i would walk yo through the steps.

  1. I highly advise you to change your IDEA to IntelliJ it is way easier to use for beginners.

  2. The main() method is the starting point for JVM to start the execution of a Java program. Without the main() method, JVM will not execute the program.

To include this main method, you need to have a code like this

public class BaseClass {
//main method
public static void main(String[] args) {
    public void sort(int array[]){
    //.......your sort algorithm      
   }
  }
}

I hope this helps

See Codecademy to learn java basics

Saheed
  • 145
  • 1
  • 9