2

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.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
guest86
  • 2,894
  • 8
  • 49
  • 72
  • Does the GUI in the applet actually *need* to be embedded in a web page, or would it work better in a free floating component such as a `JFrame`? – Andrew Thompson Jan 21 '13 at 16:23
  • No need to be part of a webpage. Page containing applet is simple index.html and all it does is starting the applet. – guest86 Jan 21 '13 at 16:24

1 Answers1

5
  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.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Too bad i can't give you + x 2 :) All that said in JWS wiki sounds nice i hope it applies to unsigned apps... – guest86 Jan 21 '13 at 16:49
  • If the applet could work unsigned, the JWS app. should have no problem (except on machines that are configured to refuse to run unsigned code - not the default). – Andrew Thompson Jan 21 '13 at 16:54
  • 1
    +1 for JWS. This [hybrid](http://stackoverflow.com/a/12449949/230513) approach may also be convenient. – trashgod Jan 21 '13 at 17:34