Tip to release a windows native exe file

Federico
2011-11-25
2013-05-01
  • Federico
    Federico
    2011-11-25

    Hi.
    I think many windows users find it difficult to run Java programs. They are used to double clicking on exe files. Even Java Webstart is strange for most windows users.

    There's an easy way to create an exe wrapper so all a Windows user has to do it download the exe and double click on it.

    All I did was:

    1) checkout sources from svn
    https://sportstracker.svn.sourceforge.net/svnroot/sportstracker
    2) Create NetBeans' Maven Java application project
    3) Maven expects java source files in /sportstracker/src/main/java and resources (META-INF, icons, properties, xml) in /sportstracker/src/main/resources, so copied those there.
    4) Add dependencies to the POM
    5) Add maven's assembly plugin to the pom
    6) Run assembly:single as a custom maven goal from inside NetBeans

    This creates a single jar file with all the libraries inside (no external lib directory needed) that is executable like this

    java -jar sportstracker-5.3.0-jar-with-dependencies.jar

    7) Convert sportstracker's icon from png to ico
    8) Use launch4j to create a windows native exe file

    Here's the result.
    http://ubuntuone.com/0DSx9WmPmXsLt8rhtGXfiF

    The netbeans maven project (including the POM file) is here
    http://ubuntuone.com/1Bca5U776JGvRS9m1eekC5

    I hope it is useful to you and maybe this application will be more appealing to Windows users.

    Launch4j still runs the program with java virtual machine, it is just a launcher.

     
  • jede28
    jede28
    2011-11-27

    Hi,

    that's a very interesting alternative for the Windows users out there. If you don't like the default double click on the JAR file behaviour, this might be your solution.

    Thanks for sharing!

    Bye, Stefan