Search code examples
javaswingappletjava-web-start

Migrating applet to JWS


I have a big Java applet (about 7 MB). It's an old and big project that's made of several (7) smaller projects all bundled-up in single jar using "fatjar". Since applet is an old technology and i have problems with functionality (my applet is not signed) can you tell me exact benefits of switching my code to JWS (Java web start) and is the switch worth it?

If i switch to JWS will i be able to split my applet into several jar's that will be loaded and used by main jar (much like dlls)? My goal is to split my current applet into several (7) separate jars. That way when i change something in one project, i would upload only one small jar containing changed project instead of whole, big, fatjared applet.

If JWS isn't much better then applets, can you suggest me some other technology that use SWING? Rewriting (and separating into MVC) the whole thing so it uses HTML or something else is a no-go. Almost all controls my applet is using are special custom controls that extend standard SWING controls.


Solution

    1. Rework the GUI to appear in a JFrame.
      1. Split the project into separate Jars.
      2. If the Jars are common to a specific API, put them into a JNLP extension. That way they can be easily used by other projects.
    2. Launch the JFrame using JWS.

    In answer to your specific questions:

    Since applet is an old technology and I have problems with functionality (my applet is not signed) can you tell me exact benefits of switching my code to JWS (Java web start) and is the switch worth it?

    Firstly, yes it is worth it.

    Immediately any of the problems you might experience with applet/browser/JVM interaction are solved. The free floating app. is resizable, and more easily customizable as to frame title etc. The user can continue using the app. when the browser is closed. They can open the app. when offline, if it is configured to allow that.

    In regard to the Jar updates, quoting the JWS tag Wiki:

    Java Web Start (JWS) is the Oracle Corporation technology used to launch rich client (Swing, AWT, SWT) desktop applications directly from a network or internet link. It offers 'one click' installation for platforms that support Java.

    JWS provides many appealing features including, but not limited to, splash screens, desktop integration, file associations, automatic update (including lazy downloads and programmatic control of updates), partitioning of natives & other resource downloads by platform, architecture or Java version, configuration of run-time environment (minimum J2SE version, run-time options, RAM etc.), easy management of common resources using extensions..

    Onto..

    If I switch to JWS will I be able to split my applet into several jar's that will be loaded and used by main jar (much like dlls)?

    Yes. As many as needed, see above for the bare details.

    If JWS isn't much better than applets, can you suggest me some other technology that use Swing?

    I'd highly recommend to use JWS/Swing. So no, I do not have any other suggestions (that would approach being that good with as little effort).

    Go ahead, try it out. I think you and your users will enjoy the change.