Eclipse cannot create runnable jar - No resources selected

51,621

Solution 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.

Solution 2

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.

Solution 3

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)

Solution 4

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 :)

Solution 5

Try this, this is the way to create a jar or runnable jar in eclipse, all your external libraries in the project will be included

File -> Export-> Java ->Runnbale JAR file

Launch configuration : your Class containing the public static void main(String[] args)

Export destination : Target place

Library Handling:

Package required libraries into generated JAR

FINISH
Share:
51,621
TrashCan
Author by

TrashCan

Updated on July 12, 2021

Comments

  • TrashCan
    TrashCan almost 3 years

    When I try to export my project as a runnable jar Eclise gives me the following error:

    No resources selected.

    The project runs fine within Eclipse, I already tried to clean the project before exporting, but that didn´t work.

    Any ideas on how to fix this.

  • TrashCan
    TrashCan almost 12 years
    I only get this pop-up when I export the project as a regular jar. Not when I export the project as a runnable jar.
  • TrashCan
    TrashCan almost 12 years
    Tried that, I am still getting the error, I also compared the build path source tab with a newly created project and found no unexpected things
  • TrashCan
    TrashCan almost 12 years
    I will try to export the project to an archive or filesystem. Then I will try to import the exported project in another workspace and try from there.
  • Lee Fogg
    Lee Fogg about 10 years
    Tried it and didn't work for me. However simply deleting the run config and re-running did.
  • tricknology
    tricknology about 10 years
    Will you please elaborate on where to find the newly created launch configuration? Everything seems the same.
  • CSCH
    CSCH about 9 years
    I think what was meant was that you choose the correct project from the dropdown menu labelled "Launch configuration", that is what worked for me, anyways
  • Vijay
    Vijay almost 7 years
    Yes. Didn't know what the exact issue is. But archiving and re-importing worked.
  • Zhiya
    Zhiya over 6 years
    I switched Eclipse's JRE to 1.8 and it worked! Thanks!
  • Ben Arnao
    Ben Arnao over 6 years
    just tried this a few times and still getting the error
  • Lightfire228
    Lightfire228 about 6 years
    Same, this fixed my issue. I was also using Maven and there was an eclipse plugin for "Java 8 support for m2e" but not one for java 9. I suspect maven (for eclipse anyway) might not support java 9 yet
  • Ericson Willians
    Ericson Willians almost 6 years
    This worked for me as well, thank you very much Sir.
  • Keith Fosberg
    Keith Fosberg about 5 years
    This solution is correct but, for newbs (like me) you should probably add that the :Launch Configuration" value at the top of the popup is a drop down. This should be obvious, I realize, but it took me 3 profanity filled attempts to grasp that and select the correct run configuration. Also; these sort of things seem to crop up when moving projects around from one device to another.