java can’t find the main method?
When we use eclipse to write java programs, we will encounter such a problem:
Error: The main method cannot be found in the class. Please define the main method as public static void main(String[] args) Otherwise, the JavaFX application class must extend javafx.application.Application
Solution:
1. Check whether the main function has No spelling mistakes (sometimes I type mian too quickly on the keyboard).
2. Click on eclipse ->window->preference->run and debug->Lunching
Change the first line to always
Run the code again to resolve the error.
php Chinese website, a large number of free Java introductory tutorials, welcome to learn online!
The above is the detailed content of Java can't find the main method?. For more information, please follow other related articles on the PHP Chinese website!