Main method not found even if I've declared it
As said in my comments, looks like you've declared a String
class among your own classes. To prove this, I've created a basic example:
class String {
}
public class CarelessMain {
public static void main(String[] args) {
System.out.println("won't get printed");
}
public static void main(java.lang.String[] args) {
System.out.println("worked");
}
}
If you execute this code, it will print "worked"
in the console. If you comment the second main
method, the application will throw an error with this message (similar for your environment):
Error: Main method not found in class edu.home.poc.component.CarelessMain, please define the main method as:
public static void main(String[] args)
Error: Main method not found in class TextBook, please define the main method as: public static void main(String[] args)
You can only run java file with main
method.
In your case, you can only run DemoBook.java
Related Topics
How to Convert "Mon Jun 18 00:00:00 Ist 2012" to 18/06/2012
How to Apply Multiple Predicates to a Java.Util.Stream
Generating 8-Character Only Uuids
Setting Print Size of a Jlabel and Put a Jradiobutton on the Print
How to Set Order of Repositories in Maven Settings.Xml
How to Convert Int[] to Byte[]
How to Clone a Generic List in Java
Java.Rmi.Connectexception: Connection Refused to Host: 127.0.1.1;
Generics with Spring Resttemplate
Configuration Using Annotation @Springbootapplication
Do Not Use System.Out.Println in Server Side Code
How to Save User Settings in Java Application
Jackson - How to Process (Deserialize) Nested JSON
How to Specify the Jdk for a Glassfish Domain
Java 8 Chained Method Reference