Eclipse cannot create runnable jar - No resources selected
Doing a (project->clean) and creating a new run configuration (with correct project and class name with main() method, selected) solved the problem for me.You just have to select the new run configuration while exporting runnable jar :)
I found another solution.
I found that there's a bug in JDK 9.
I solved it by downgrade to JDK 8(1.8.1)
I fixed the problem, I exported the project as an archive file. Then I opened up a new workspace and imported the the archived project. After that I tried to export the project as a runnable jar, after two tries the jar runs as is it should.
I still don't know what the exact cause was but I hope someone how has run into the same problem finds this helpful.
The problem is most likely with your run configuration.
- Go to your Class that contains the main(String[] args) method you wish to automatically run when the jar is called from the command line
- Right-click->Run As...->Application
- Make sure it runs to your satisfaction
- Now go through the export process as before, selecting the newly created launch configuration.
The last step is key.