0

I have an application which is composed of many JFrame objects (using Java and Netbeans). The 'main' frame has 4 buttons and each button opens another frame. Now my problem is that I want the whole application to be run on the web as a website.

I was considering 3 possible scenarios (from my research):

  1. Use Java Web Start
  2. Convert JFrame to JApplet
  3. Create from scratch a Java web application

I was hoping that maybe someone can give me some help, and guidelines of which option I should opt for.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user3189635
  • 1
  • 1
  • 3

2 Answers2

1

The quickest option is to modify your application to run as an applet (yes, this would involve making a JApplet from your JFrame). However, you should realize that the Java Applet is considered an outdated technology. Most mobile devices won't run them and even some popular desktop browsers won't (Mac Chrome). What's more, Oracle now requires all applets to be signed in order to run with default security settings. This means purchasing a yearly (~$200) signing certificate.

Java Web Start is not really fundamentally different from applets and will suffer the same issues as above.

Think again about your choice of technology. A Java web application (e.g., Spring MVC) or a JavaScript application (e.g., GWT, JQuery) are better choices.

martinez314
  • 12,162
  • 5
  • 36
  • 63
  • *"The quickest option is to modify your application to run as an applet"* No it's not. I've deployed a number of hybrid application/applets and the applet deployment is never easy or straightforward. – Andrew Thompson Mar 11 '14 at 10:57
  • @AndrewThompson JWS would maintain more of the desktop nature of the application and so would be easier than converting to an applet, yes. That said, JWS is a technology that never really took off and is going to be unfamiliar to most users. It won't provide the "run on the web as a website" experience. I think the correct option is one that will guide the OP away from both applets and JWS. – martinez314 Mar 11 '14 at 13:48
  • *"..would be easier than converting to an applet"* The 'converting to an applet' is the *easy* part. ***Deploying the applet*** is the hard part. – Andrew Thompson Mar 11 '14 at 21:14
  • *"I think the correct option is one that will guide the OP away from both applets and JWS"* I agree that might be the best solution. But I am just trying to underline that a mixed HTML/Applet site would be the least optimal solution. Either make it a rich desktop client launched using JWS (which I prefer as a user), or pure HTML/JS in a browser. – Andrew Thompson Mar 11 '14 at 21:19
  • *"Java Web Start is not really fundamentally different from applets and will suffer the same issues as above."* It is, in that 1) When Chrome drops support for applets, JWS Apps will be unaffected (though the `deployJava.js` commonly used to launch them will fail to work). 2) The JWS app. can avoid the usual *"the **browser** has blocked a potentially unsafe component from running"* hurdle. - Applets have become an unworkable tech. for general desktop PC users in modern times, while JWS apps. are still very much functional. Now both need to be digitally signed & that was always a good idea. – Andrew Thompson May 09 '15 at 02:42
1

For deploying Java desktop apps., the best option is usually to install the app. using Java Web Start. JWS works on Windows, OS X & Unix/Linux.

Applet deployment has always been difficult, with weird bugs in particular versions of specific JREs in conjunction with particular browsers. My 'favorite' bug happened in a version of Firefox that triggered an applet to reload when the user scrolled up in the web page.


See also The Use of Multiple JFrames, Good/Bad Practice?

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433