I have a class that implements Runnable, but Eclipse needs a public static void main method in it. Is it ok if the main is completly empty?
public class Launcher implements Runnable{
private String message;
public Launcher(String message) {
this.message= message;
}
public static void main(String[] args) {
}
@Override
public void run() {
//My implementations
}
If you intend Launcher
to be the main class of the application, the one you use to start it, the main method is needed and must do whatever should be done to start work.
If not, delete the main method. Eclipse does not require a main method unless you start the application by telling it to run the class. It will optionally generate one when creating a class, but that can be edited out if not needed.