Launch4J - how to attach dependent jars to generated exe

前端 未结 7 911
深忆病人
深忆病人 2020-11-28 13:43

I have a simple java project, which requires external jars. I build this with netbeans and after Clean and Build command, I can find in dist directory the following structur

7条回答
  •  春和景丽
    2020-11-28 14:31

    I have spent hours on this issue. So here is my contribution.

    The problem here: how to sucessfully put your external jars that your .JAR program needs INSIDE the .exe that you generate.

    We assume that you already, and correctly, configured the external jars on eclipse/netbeans and ALL WORK FINE with the command: java -jar yourprogram.jar.

    So the real problem is how to ensure that this .EXE file will contain the external jars, otherwise it will not work properly.

    1) First of all, you need to forget Launch4J and anyother program.

    2) Install JSmooth, I recommend that you use the windows version.

    3) On the left menu there is a button "Application". Click on it.

    4) You will see a tab "Classpath" panel. Click on the plus (+) and add your external .jar's files. And that is it!!

    Don't forget to put your .jar application marking checkbox "use am embedded jar" and choose the main class properly. It will work.

提交回复
热议问题