This discussion is archived
3 Replies Latest reply: Jun 28, 2011 8:17 PM by Narayan RSS

Windows Executable

869351 Newbie
Currently Being Moderated
Hello Everybody,

I just finished my first javaFX program and want it to be executable in Windows as .exe or .jar.

So I googled the net and did not found anything about it, neither was I successful trying it myself with Netbeans (6.9.1)

May someone to explain to me how it works? Or link a tutorial (which didnt show up on google or my queries were not matching)


regards!
  • 1. Re: Windows Executable
    shakir.gusaroff Expert
    Currently Being Moderated
    If you have developed a Javafx script application, then take a look at this link:
    http://download.oracle.com/javafx/1.3/tutorials/deployment/deploy-outside-ide.html


    If you have developed a Javafx2.0 application, then take a look at this link:
    http://download.oracle.com/javafx/2.0/deployment/jfxpub-deployment.htm
  • 2. Re: Windows Executable
    bouye Journeyer
    Currently Being Moderated
    I am assuming this is about JavaFX 1.3 as 2.0 is still far from being release.

    Have a look at Launch4j http://launch4j.sourceforge.net/ (there may be other similar product).
    You may also want to pay attention to this article : Distributing a Java Web Start Application via CD-ROM http://today.java.net/pub/a/today/2008/07/10/distributing-web-start-via-cd-rom.html

    Using this you can create a Swing or AWT based installer with an embedded JVM that takes care of setting up the JVM (if not already installed on the underlying system) and registering your JavaFX app to Java Web Start.
    Note: you can also create a native, .NET, Flash, whatever installer that calls Java Web Start.


    Please note that I've experienced a couple of issues doing that though:

    - If you plan to distribute a self sufficient exec, packaging embedded JVMs + JRE installers (i.e.: for Linux & Windows) makes the size of the whole thing explode so it's better suited for CD-ROM distribution than web downloads.
    You do not need to take care of that if you just want to distribute a bare-bone exec and ask your user to install the JVM themselves 1st.

    - on 64bit Windows (probably Linux too) you need to install the 32bit JRE as JavaFX 1.3 only runs on 32bit JVM.

    - there are bugs in Java Web Start. Somethings the registration process (that is invoking a process that does javaws -import <name of the JNLP>) stalls or fails and the dam app is not even able to return a proper error code (making it hard to detect).

    - JRE installation is not able to return proper error code when canceled by the user or failing.

    - You need a working Internet connection (to be able to download JavaFX 1.3 runtimes).

    - JavaFX 1.3 runtimes caching causes issues: for some STUPID reasons, a pair of files described in http://dl.javafx.com/1.3/javafx-rt.jnlp are set to be downloaded lazily (see below) which means they are downloaded only when needed (in theory).
    Unfortunately the whole dam JWS does not really work that great so the files javafx-rt-lazy-windows-i586__V1.3.1_b101.jar & javafx-rt-fonts-windows-i586__V1.3.1_b101.jar are not downloaded at all (at least on our network) which makes the whole program crash with ClassNotFoundException when trying to use classes such as javafx.fxd.FXDNode or things that rely on LazyFont (a class in the private API) while other part of the program may work Ok (basic scene graph node handling for example).
       <jar href="http://dl.javafx.com/1.3/progressbar__V1.3.1_b101.jar" download="progress" main="false"/>
        <jar href="http://dl.javafx.com/1.3/javafx-rt-windows-i586__V1.3.1_b101.jar" part="javafx-rt" download="eager" main="false"/>
        <jar href="http://dl.javafx.com/1.3/javafx-rt-lazy-windows-i586__V1.3.1_b101.jar" part="javafx-rt" download="lazy" main="false"/>
        <jar href="http://dl.javafx.com/1.3/javafx-rt-fonts-windows-i586__V1.3.1_b101.jar" part="javafx-rt" download="lazy" main="false"/>
    One way to circumvent the issue would be to make your installer try to cache the whole runtimes by calling:
    javaws -import http://dl.javafx.com/1.3/javafx-rt.jnlp
    Unfortunately I've found out it's not working Ok all the time.

    You'd better have a look at the Oracle Java Web Start forum (Java Web Start & JNLP too and get a hand on Andrew Thompson's JaNeLA program as it will help you validate the XML structure of your JNLP(s).
    A lot of base JWS issues are related to bad structure of JNLP coupled with bad Sun/Oracle JNLP documentation (actually the JNLP references contains much much more correct and useful info than the Programmer's guide).
    And for info NetBeans does produce bad or insufficient JNLPs.

    Even after that other outstanding issues with Java Web Start persist such as :
    - program icon looks like crap on Windows Vista & 7
    - program shortcut may not be created at initial installation
    - program shortcut disappear or stop working for unknown reasons
    - program fails to update itself
    - program pauses for a long time before actually starting (seems related to a network timeout).
    - etc.
  • 3. Re: Windows Executable
    Narayan Pro
    Currently Being Moderated
    Hello, You can easily execute the jar files via JNLP.

    You must first have good knowledge of deploying Jar files. You can not only execute jar files but also you can create Desktop Shotcut, StartMenu Programs via JNLP.

    http://javanepal.wordpress.com/2009/10/15/jnlp-on-desktop-and-start-menu-with-icon/
    http://blog.ngopal.com.np/?p=550

    Thanks.
    Narayan

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points