Eclipse Java; export jar, include referenced libraries, without fatjar

557

Solution 1

The next version of Eclipse (3.5, due next June) has an option to include all necessary jars. It was introduced in 3.5M5 (thanks, basszero).

Or you can try to build your project with Maven 2. Then, you can build a "fat" jar with mvn assembly:assembly.

Another option is to use ant. Unpack all JAR files into a temp directory and jar them up again.

Solution 2

I think its version 3.3 of Eclipse (ganymede) that has Export as Runnable JAR file. Last time I tried it, it did include the referenced libraries and also un-jars all the jars.

Solution 3

This feature of eclipse works just fine to dump only the referenced libraries into separate folder. "Export as Runnable Jar" with "Copy the referenced libraries into a subfolder .." option.

Solution 4

Just posting a little (Helios) gotcha for using the Eclipse export Jar - you must first run (in Eclipse) a class with a main() method, otherwise the "Launch configuration" dropdown will be blank and you'll not be able to export.

Share:
557

Related videos on Youtube

NaniSore
Author by

NaniSore

Updated on July 09, 2022

Comments

  • NaniSore
    NaniSore almost 2 years

    I am trying to make a external svg file work in ie11. I know it's not natively supported but I decided to use svg4everybody. However it just won't work.

    Here is the markup of a small example:

    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="utf-8" />
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>SVG Test</title>
    
        <script src="svg4everybody.js"></script>
        <script>svg4everybody();</script>
    </head>
    
    <body>
        <svg role="img" title="CodePen">
            <use xlink:href="sprite.svg#icon-twitter" />
        </svg>
    </body>
    
    </html>
    

    And the sprite.svg:

    <svg xmlns="http://www.w3.org/2000/svg">
        <defs>
            <symbol id="icon-twitter" viewBox="0 0 24 24">
                <title>twitter</title>
                <path d="M23.954 4.569c-.885.389-1.83.654-2.825.775 1.014-.611 1.794-1.574 2.163-2.723-.951.555-2.005.959-3.127 1.184-.896-.959-2.173-1.559-3.591-1.559-2.717 0-4.92 2.203-4.92 4.917 0 .39.045.765.127 1.124C7.691 8.094 4.066 6.13 1.64 3.161c-.427.722-.666 1.561-.666 2.475 0 1.71.87 3.213 2.188 4.096-.807-.026-1.566-.248-2.228-.616v.061c0 2.385 1.693 4.374 3.946 4.827-.413.111-.849.171-1.296.171-.314 0-.615-.03-.916-.086.631 1.953 2.445 3.377 4.604 3.417-1.68 1.319-3.809 2.105-6.102 2.105-.39 0-.779-.023-1.17-.067 2.189 1.394 4.768 2.209 7.557 2.209 9.054 0 13.999-7.496 13.999-13.986 0-.209 0-.42-.015-.63.961-.689 1.8-1.56 2.46-2.548l-.047-.02z"></path>
            </symbol>
        </defs>
    </svg>
    

    Expected result (firefox) - Firefox

    In IE11 - IE11

    • Aaron Digulla
      Aaron Digulla about 15 years
      Please explain why you can't use farjar. Everyone recommends it because that's what everyone uses and it works well. So why should there be a another tool to do the same thing?? confused
  • Anne Porosoff
    Anne Porosoff about 15 years
    The recent milestone version of Eclipse (3.5M5) includes the feature you just mentioned.
  • cabad
    cabad over 10 years
    This is almost the same answer as that provided by @bernie-perez. Should have been posted as a comment to that answer instead.