3

I'm working on research to move an existing applet (extends Applet) to Java Web Start due to the deprecation in Java 9. However, it seems like most of Oracle's migration docs instruct the dev to use the "applet-desc" tag to create a new JNLP and migrate. Does this mean that launching applets outside of the browser will not be deprecated?

If not, then what is the recommended approach? Saying "rewrite your applet" doesn't help... that's what everyone says. Doesn't really give me the "how".

What are possible solutions and examples/tutorials of migration? I can't seem to find much newer documentation out there, I see a lot of stuff between 2001 and 2011. It seems like most websites that provide examples no longer host the applications, or they aren't properly signed.

EDIT

My most important part of the question is: Is Oracle deprecating the Applet class when deprecating the browser plugin? Or, can we still use classes extending Applet within the tag in a JNLP, without a deprecation warning?

My applet requires user authentication and session cookies that are dynamically generated in our JSP. I've seen online that this is possible. This JWS application is not to be used offline, and is meant to be launched from an HREF. Is this still valid?

Community
  • 1
  • 1
ryan
  • 89
  • 10
  • Depending on what your applet does, there may be not much to rewrite. What you do have to write (and read about and understand) is the jnlp file. You are correct in "starting applets outside of browsers will not be deprecated" - exactly that can be done with java web start. – Stefan Hegny Jul 18 '16 at 19:17
  • Awesome, so you mean we can still extend Applet and we just need to serve JNLP XML tags instead of HTML tags? I'm referring to instructions I found at: https://kbdeveloper.qoppa.com/?p=2404. I know more work will need to be done to keep our user sessions up.. we currently have some CSRF cookies to pass along. We already load the applet in a JSP; since we already use a JSP, should it be as simple as changing content-type to "application/x-java-jnlp-file" and appending the request variables to the JNLP url? – ryan Jul 18 '16 at 19:37
  • Also, if someone can help explain the difference between the jnlp.jar and jnlp-servlet.jar, that would be awesome. I'm not quite sure which to include? Any useful guides you're aware of are very much appreciated :) – ryan Jul 18 '16 at 19:40
  • You might add that to the question, but where do you get jnlp.jar from? Cookies might be a bit difficult, because the java webstart has nothing to do with a browser (except for using the browser to download the jnlp and throw it at javaws's feet). Also the stuff with the request param - the jnlp contains it's own url so any request parameters would have to go into the jnlp twice (once for the url of itself and once as parameters to the jar to produce any effect) – Stefan Hegny Jul 18 '16 at 20:36
  • I've read some old sites referencing WebStart libraries that need to be taken from the '/samples' directory of the JDK and imported into the server; is this no longer true? How else would my program know how to read a JNLP document without the libraries? As for the cookies- this is a problem. I suppose that it should be possible to have the user log in a second time if we cannot pass along the authentication; think that's my best bet? – ryan Jul 18 '16 at 21:15
  • The jnlp is read by the javaws executable from the jre on the client after the browser has downloaded it. However, I have only done it without an application server. You can prepare the jnlp manually, or maybe the appserver can do something for that. – Stefan Hegny Jul 19 '16 at 07:14

1 Answers1

2

The thing that is deprecated is done by the browser manufacturers (though Oracle, realising the situation now advises not to develop them). So Oracle has not 'deprecated' the applet tag(1) in the same way that it has deprecated other classes, methods or attributes as occasionally mentioned in the Java Docs.

As to launching the applet using JWS, yes that should still 'work'. But note that whereas (for example) Chrome used to pass a JNLP direct to the program registered as a consumer of that file type (wherein it would be passed to the Java Web Start Client included in the JRE), it now causes the user to first download the JNLP, then explicitly choose to launch that file.

  1. Update: Oracle may not have deprecated the applet tag, but they'll do effectively the same thing come Java 9. From JDK 9 and the Java Plugin:

By late 2015, many browser vendors have either removed or announced timelines for the removal of standards based plugin support, eliminating the ability to embed Silverlight, Java, Flash and other standards-based plugin technologies.

Oracle plans to deprecate the Java browser plugin in Java Standard Edition Development Kit 9 (JDK 9). Deprecation is a warning for developers to stop using this technology. JRE 9 will continue to provide the Java Plugin and support launching applets on browsers that still offer standard plugin support. This browser plugin will be removed from the Oracle JDK and JRE in a future Java SE release. Developers and users who want to learn more about this planned change can find out more in this blog post.

Community
  • 1
  • 1
Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
  • Thank you for the information, good to know about Chrome; compatibility for browsers other than IE is the hope; do you know if Edge launches JWS? Or only IE? – ryan Jul 19 '16 at 13:13
  • Actually, Oracle is deprecating browser plugins in 1.9, intending to remove it entirely at a later date. Just wasn't sure if that meant the entire class would be gone. I'm wondering, can you just instruct Chrome to "always open files of this type" after you download the first JNLP? – ryan Jul 19 '16 at 13:47
  • *"can you just instruct Chrome to "always open files of this type" after you download the first JNLP?"* I neither know nor care, given that is not something you should be telling the end user. Just give them simple instructions - like *"Open it after it downloads, to launch the app.."*. – Andrew Thompson Jul 19 '16 at 15:43
  • Totally agree, but unfortunately, sometimes companies don't have the resources to do a complete rewrite of a widely-used application :\. – ryan Jul 19 '16 at 16:48
  • *"sometimes companies don't have the resources"* (shrug) Tell me something that makes me care.. BTW - adding that suggested text beneath the download link is nothing to do with rewriting the app. – Andrew Thompson Jul 19 '16 at 17:05
  • Wasn't asking for you to care, was asking for help in my specific dilemma that is out of my control heh. Suggested text? What if I don't *want* to rewrite the app, and want to do something like this: https://kbdeveloper.qoppa.com/?p=2404 – ryan Jul 19 '16 at 17:16
  • *"Suggested text?"* Yes: *"Open it after it downloads, to launch the app.."* BTW - *"was asking for help in my specific dilemma"* So why mention companies? If it's your company or your job at a company, my suggestion is to hire someone like me that has a hope of fixing it. But for free, you get the level of caring I've mentioned. But don't fret - if my free solutions are not good enough, you can always get a refund of all monies paid. – Andrew Thompson Jul 19 '16 at 17:26
  • Thank you for your attempt to help, but unfortunately, that option is not at my disposal as previously mentioned, so I will await an answer geared towards what I am looking for. I see what you mean about the "Open it after it downloads", but I'm still looking for behavior similar to the link provided in my previous comment. – ryan Jul 19 '16 at 19:33
  • I only just followed that link now (in Chrome). The JNLP link shows.. http://i.stack.imgur.com/PsG5e.png. So, besides my suggestion to add an helpful text to the launch page tell the user how to handle it, what more (exactly) were you expecting? – Andrew Thompson Jul 19 '16 at 19:42
  • I was hoping to get more detail on how to implement what is implemented there, as it doesn't speak of importing any Jars or the actual applet class. This site says there shouldn't be any changes needed to the applet class, but I'm seeing that Oracle docs specify to modify the applet class to use a main method, so I'm not sure what else that guide may be leaving out. – ryan Jul 19 '16 at 20:15
  • *"but I'm seeing that Oracle docs specify to modify the applet class to use a main method"* Link, please? No that is certainly not necessary, unless you want to run the app. using an [`applicaton-desc`](http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#application_desc). An applet would use an [`applet-desc`](http://docs.oracle.com/javase/7/docs/technotes/guides/javaws/developersguide/syntax.html#applet_desc).. – Andrew Thompson Jul 19 '16 at 21:23
  • I apologize for all of the confusion; I was misunderstanding quite a bit and have done further research. I'm still learning Stackoverflow and realized that my follow-up questions were separate from the original: if the applet class will still exist once JRE 9 deprecates the plugin. Thank you very much for your help, I've accepted your answer, and if I have any specific questions, I will be sure to create less general inquiries in the future :) – ryan Jul 28 '16 at 20:37