Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

window not opening  RSS feed

 
Michael Nassey
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i was following a tutorial, as far as i can see i did everything the same, i am pretty sure he is using a different version of java than me.
when i press the run client button it comes up with this error in the console;

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

i am using java 8

please help´╗┐
 
Chris Barrett
Bartender
Posts: 321
24
Eclipse IDE Firefox Browser
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

Welcome to the Ranch!

The tutorial you are following may indeed have been written using a different version of Java, but that generally wouldn't matter. Usually with tutorials, it would only be an issue if you were using a version of Java older than the version the tutorial was written. And even then, unless this is a very old tutorial, most tutorials written in Java 5, 6, or 7 should work fine against Java 8.

Have you defined a main method using the signature exactly as provided in the error message?

The main method provides an execution entry point for your program. Without one, or if there are any mistakes in the signature ( such as writing the method name as 'man' instead of 'main', or writing the parameter type as a String instead of a String[] ), the Java runtime won't understand where to begin. So, I would start your debugging process.

Unless this is a JavaFX application. Then the process would be different as the error message indicated.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!