Skip to main content

javax.jnlp.* access in applets

6 replies [Last post]
brackeen
Offline
Joined: 2008-03-02

In b22 applets, it looks like access to the javax.jnlp.* classes is only available if the applet has a jnlp file. Maybe there is a good reason for this. But would it be possible to allow access to these APIs even if a jnlp file isn't used?

On the surface it looks like creating a JNLP file is quite easy, but it's actually complex (I've spent at least an hour debugging one - it didn't like the name of my jnlp file, among other things). For simple applets, with fast development in mind, it would be worth avoiding.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
cayhorstmann
Offline
Joined: 2003-06-13

Don't mind jwenting--he must be having a bad morning. Your question is entirely reasonable. It would indeed be desirable to have access to the JNLP API in an applet, without having to produce a JNLP file. And, yes, those files are a pain in the behind. I hope someone from Sun can weigh in on the reason.

Cheers,

Cay

kbr
Offline
Joined: 2003-06-16

The implementations of several of the JNLP services require access to a "launch descriptor" which describes the origin of the app, etc. This launch descriptor is provided implicitly by the presence of the JNLP file which launched the applet and is not available for legacy applets.

I agree that creating a JNLP file by hand is a bit tedious, but we are hoping that NetBeans and other tools will help with this. There are also some simple applet examples in the new Java Plug-In's release notes which you can use as a template.

brackeen
Offline
Joined: 2008-03-02

For simple applets, the only unique info in my JNLP (that isn't in my applet tag) is the "title" (using the jar name) the and "vendor" (using the domain name). The rest is duplicated information.

So it seems possible that an implied "launch descriptor" could be defined from the applet tag info. If you think it's technically possible, I'll file an RFE.

kbr
Offline
Joined: 2003-06-16

Sorry, but the clear way forward is describing applets via JNLP. There is a lot of functionality that is only enabled when you have a full JNLP descriptor available. I don't think we should spend the time on trying to make this work for older applets.

brackeen
Offline
Joined: 2008-03-02

Okay.

In that case - how about a way to create a JNLP in javascript, like how Deployment Toolkit's deployJava.js creates the applet tag? Ideas: embedding JNLP content in the XHTML (like how inline SVG can be embedded in XHTML) or letting the jnlp_href handle a javascript: url.

Another problem I ran into is that the applet description has to be identical to the JNLP description (for example, the "java_arguments" has to be identical). If the values aren't identical, two VM instances are started - one for the initial boot and load the JNLP, another to start a VM instance with the params in the JNLP file. Obviously starting two VM instances should be avoided by the developer, since this is slower, uses more memory, shows two Java icons in the system tray, etc.

So, any way to create the JNLP in javascript could eliminate those errors, and eliminate the need to copy & paste to/from the applet tag and the JNLP file.

jwenting
Offline
Joined: 2003-12-02

wow, so you can't use JNLP without having JNLP configured.
Who'd have thought?