This week's book giveaway is in the HTML Pages with CSS and JavaScript forum.
We're giving away four copies of Testing JavaScript Applications and have Lucas da Costa on-line!
See this thread for details.
Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

APPLET tag is not working with self-signed applet jar

 
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've self-signed applet jar. I've created the policy file also (granting all permission). This applet is basically uploading multiple files using HttpClient to post request. I'm able to run via appletviewer command like:
appletviewer -J-Djava.security.policy=mypolicy signedapplet.html . It works fine. But when i embed it into my html file and try to open the html by clicking on it, the applet got successfully loaded but when i browse a file then it throws an exception. Exception on java console..
java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\Navneet\My Documents\Jassi.doc read)

I don't know where i went wrong. If it works on appletviewer, why not on html.Do i need to do something extra to work it.

Any suggestion/solutions are most welcome.

thanks in advance
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For starters, if the applet is signed properly, then there is no need for any policy changes. Signing the applet confers all right to it.

Secondly, the browser JRE will not know about any security policy file changes unless you make them to the policy file that governs that particular JRE. Looks through its installation directories to find its policy file.

Lastly, it's always a bit of a gamble what happens if an applet is started by double-clicking an HTML file. Put the HTML and applet on a web server, and start it properly through its web page. That'll be a more reliable indicator of what happens in a real environment.
 
Navneet Singh
Greenhorn
Posts: 29
Netbeans IDE Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply.
I followed the process what u've said. But still it doesn't work. I'm getting the same exception. I followed the way for signing applet jar as described in "http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html"; then i've put the jar where my signedApplet.html is located. I've written following code in signedApplet.html
"<html>
<body>
<applet height="271" width="226" code="JFileChooserTest"
archive="SUploadFilesApplet.jar,lib/commons-httpclient-2.0.jar,lib/commons-logging-1.1.1.jar">

</applet>
</body>

</html>"

Is that because of self-signed application? I've also uploaded the CompanyCer.cer in my IE.
 
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic