Menu

Packageing multiple jars in the exe

2005-10-23
2013-06-12
  • Andrew Serff

    Andrew Serff - 2005-10-23

    Hi,

    I just found your proect here and was all excited cause you have an ant task for it and it works on linux as well.  But now I'm wondering if I can use it.  My application uses other jar files.  Things like log4j for example.  So I need to be able to have my executible jar file and then all the other jar file I need to all be bundled up into the exe file.  Can this be done?  I can't imagine no one else has asked for this before...Let me know.

    Thanks!
    Andrew

     
    • Andrew Serff

      Andrew Serff - 2005-10-23

      Ok, I took a look at the Builder source code and it looks like you only add what is referenced by the <jar> element in the properties file.  I don't know how the layout of the exe works, but I know other install makers do this, so can't you just take a list of jar files and write them all to the exe?  I would try it, but I don't know how to build your app.  You don't have any source in CVS, so I assume you are the only one working on this and have your own setup to build.  Let me know if you think this is possible and when you would be willing to implement it.  Thanks!

      Andrew

       
    • Grzegorz Kowal

      Grzegorz Kowal - 2005-10-24

      Hi,

      It won't work because launch4j doesn't extract anything from the output executable, which is a jar. It would be like appending one jar to another. Use NSIS or Inno Setup to create a single file installer and launch4j to turn your application jar into an executable file.

      Grzegorz

       
    • Patricio M. Ros

      Patricio M. Ros - 2005-11-05

      You could try to use One-JAR (http://one-jar.sourceforge.net/) to make a only jar file. Then use launch4j with this jar file. I don't test yet, but it may work. There is an eclipse plugin for one-jar (http://fjep.sourceforge.net/).
      This is my first post in this forum, I hope it be useful for you.

      Patricio

       
      • Andrew Serff

        Andrew Serff - 2005-11-05

        Actually, I'm using NSIS now.  There is a script out there called jelude that is just a pre written nsis script that will make your exe for you.  So now I have all my jar files going into one exe file.  I have no use for launch4j now...so anyone else needing the same thing, check out nsis.

         
        • Grzegorz Kowal

          Grzegorz Kowal - 2005-11-05

          Launch4j is not an installer/setup program, it starts Java applications packaged as jars without extracting them. NSIS is a great project - launch4j 2.0.0 installer was created with it and I recommend it whenever somebody ask about packaging multiple jars. But using an installer to run a program is a different thing. First of all, either Jelude has to extract all files EVERY time someone runs the program - as if the startup process wasn't slow already. Or it can leave the extracted files somewhere on the disk and extract newer files only - end of single exe magic.
          Programs should be distributed as single files, whether executable installers or zip archives, there's no doubt about that. But what good is pretending that your program is a single file, when it's not. Especially if it causes performance problems.

          Grzegorz

           
      • Thorbjoern Ravn Andersen

        The FAT Jar Eclipse Plugin works very, very well for me with multiple projects being put in a single jar directly from Eclipse.

        I have verified that these generated Jars work with launch4j 2.1.1.

        In my eyes this is a perfect combination.

         
    • Anonymous

      Anonymous - 2006-02-22

      I use Maven1 and Maven2 to build my exectuable "uberjar".  In Maven1 I use the javaapp goal and in Maven2 they have a built in Assembly goal to build the uberjar.  I then called Launch4j Ant script as a post goal so in one Maven step I can build all my code, build the jar, and then wrap it in Launch4j exe.  It works incredibly well for my purposes.

       
    • Grzegorz Kowal

      Grzegorz Kowal - 2006-02-23

      I agree. If someone must create a single file application then a jar with all dependencies is the way to do it.

      Grzegorz

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.