First, make sure you create a regular “Java Project”, and not something else.
If something is wrong with the build configuration, and I think there is, go to: Run> Run Configurations ... On the left you will see a list of configurations, make sure your configuration runs as a "Java application", if not, delete all configurations by selecting them, and then click Delete.
If everything is ok, your program should work fine
source
share