2

I have a gwt based application that tries to launch an applet via jnlp file(jws). Something like this: How to display java applet inside GWT page?

Instead of directly launching the applet , I am specifying the parameter jnlp_href to use a jnlp file to launch it.

My jnlp file looks something like-

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.6+" codebase="." href="jconsole.jnlp">
<information>
  <title>JConsole WebStart</title>
  <description>Launching JCOnsole via web start</description>
  <offline-allowed/>
</information>
<security>
  <all-permissions/>
</security>
<resources>
  <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" />
  <jar href="launchJConsoleAppletForRose.jar" main="true"/>
  <jar href="common.jar"/>
</resources>
<applet-desc
  name="MyJConsoleApplet"
  main-class="rose.applet.LaunchJConsole"
  width="100%" 
  height="100%">
</applet-desc>

The issue here is it starts up fine in IE11 and firefox. I enabled debugging and show console and I get proper console messages when the applet is launched via jnlp. However, it does not work with chrome v 47.0. The window just disappears after few seconds. There are no log messages, stack trace or console output. Any idea how to debug this or what could be wrong?

Community
  • 1
  • 1
lavina
  • 21
  • 4

2 Answers2

0

Applets simply aren't supported anymore in Chrome: https://java.com/en/download/faq/chrome.xml

(BTW, in other browsers, given Java's history of sandbox vulnerabilities, you're advised to disable applets anyway)

Thomas Broyer
  • 64,353
  • 7
  • 91
  • 164
  • Is there any other way to make it work? I was following this http://docs.oracle.com/javase/8/docs/technotes/guides/deploy/applet_dev_guide.html#JSDPG1032 to migrate applet to use jnlp . – lavina Jan 19 '16 at 11:21
  • I think you'd have to make it a Java Web Start application. – Thomas Broyer Jan 19 '16 at 16:33
  • Thomas, JNLP is the file descriptor for a JWS launch! lavina, it is possible to launch an applet, free floating on the desktop, using JWS. Just link to the JNLP instead of linking to the HTML containing the applet tag. – Andrew Thompson Jan 21 '16 at 01:00
  • @AndrewThompson I know that, but @lavina is using JNLP with an `` tag: https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/applet_dev_guide.html#JSDPG1032 – Thomas Broyer Jan 21 '16 at 10:02
  • Yes, but there are two ways that an applet can be launched using JNLP/JWS. Since JWS was introduced in 1.2 (it came standard with the JRE from 1.4.2) an applet could be launched, free floating using JWS. Since 1.6.10(?) they introduced the ability to launch an applet using JWS **while it was still embedded in a web page.** It is the latter 'embedded' type that is becoming impractical due to browser deciding not to support applets any more. But it should still work for 'free floating' no matter what the browser itself supports (or does not support). – Andrew Thompson Jan 21 '16 at 12:48
  • >> Just link to the JNLP instead of linking to the HTML containing the applet tag: In GWT: I am using something like myHtml.setHTML(appletLaunchStr); . Now the issue is appletLaunchStr contains some extra applet parameters(dynamic based on whatever the user clicks on) that are used by the main class of applet via getParameter() method. If I completely eliminate the applet tag, is there a way to pass all those parameters to the main class ? – lavina Jan 22 '16 at 07:17
0

This is fixed now.I rewrote my applet class to a stand alone java application. However, I needed to create dynamic jnlp as my main class requires some run time parameters. I passed the parameters through servlet mapping via my gwt entry class to a jsp . The jsp takes care of dynamically generating the jnlp file as described in http://justobjects.org/cowcatcher/browse/advjava/slides/java-dev-env/core/deploy/slide.0.20.html which solves the issue.

Cheers !

lavina
  • 21
  • 4