Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

applet deployment by HTML

 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know that the simple deployment using only applet tags inside HTML causes severe security restriction for the applet on the client side. but can this simple HTML file contains .jar files inside the applet tags instead of .class files.
 
Paul Clapham
Sheriff
Posts: 21546
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTML file with the <applet> tag in it can't "contain" any jars, because of course HTML is text and the jars aren't anything like text. But the <applet> tag can certainly refer to jars which should be used, instead of to a class file. It can even refer to both if you want. But it sounds like you're asking because you need your applet to be in a signed jar. And that isn't a problem.

Here's a link to the relevant Oracle tutorial: Deploying With the Applet Tag.
 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I was asking because every applet in my book is using JNLP files referring to jar files but no HTML files uses jars. they only refer to class files and when I tested it myself to contain jar file inside the HTML file without JNLP file, it didn't work
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As Paul said, HTML can not contain jar files in any way. An APPLET tag can refer to jar files via the archive attribute (which is explained in the link Paul posted).

JNLP files are used JavaWebStart apps, not applets - those are two different ways of deploying Java client-side apps via the web. You shouldn't try to mix the two.

Update after seeing Paul's response: I stand corrected. Apparently my knowledge of applets is as dated as applets themselves :-)
 
Paul Clapham
Sheriff
Posts: 21546
33
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually it is possible to deploy an applet using a JNLP file, and there's an example in the link that I posted. This must be a new feature, and I've never tried doing it that way. Also it says the applet is "launched using JNLP", which I suppose means that it launches as a separate application rather than as an applet inside the browser. In this case the jars would be configured in the JNLP file rather than in the applet tag.

In fact the tutorial even says "Using JNLP is the preferred way to deploy an applet" -- but as I said, this is something I'm not familiar with.

Edit: No, I just tried the launching-using-JNLP example in the tutorial and it does launch the applet as an applet, inside the browser.

But apparently Mohamed is asking about the old way, the "Manually Coding Applet Tag, Launching Without JNLP" way. In which case we would want to know what he meant by "didn't work". The error messages from the Java console would be a good starting point, but other descriptions of the problem would help too.
 
Mohamad Samy
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I did what you exactly said and included in the applet tag the class file an archive element with my jar file and the application was launched successfully but as you mentioned, it is the old way. it is better making JNLP file to get the privilege of accessing the client file system if needed.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic