• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Signed jar won't work...

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I signed the jar for my applet using jarsigner.
the applet is made for browsing your harddisk in order to upload some pictures so I needed a signed applet.
Anyway I signed the applet and still i get this error:

java.security.AccessControlException: access denied (java.io.FilePermission C:\Documents and Settings\josy\Mijn documenten read)
at java.security.AccessControlContext.checkPermission(Unknown Source)
at java.security.AccessController.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkPermission(Unknown Source)
at java.lang.SecurityManager.checkRead(Unknown Source)
at java.io.File.isFile(Unknown Source)
at sun.awt.shell.ShellFolder.isFile(Unknown Source)
at com.arashpayan.filetree.FileTree.populateSubTree(FileTree.java:236)
at com.arashpayan.filetree.FileTree.initRoot(FileTree.java:151)
at com.arashpayan.filetree.FileTree.initComponents(FileTree.java:113)
at com.arashpayan.filetree.FileTree.<init>(FileTree.java:53)
at UploaderPack.Uploader.init(Uploader.java:81)
at sun.applet.AppletPanel.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

AnyOne?
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I haven't done it myself, but I've heard people say running code as privileged code helps. See the last paragraph of "Signing an applet" in http://faq.javaranch.com/java/HowCanAnAppletReadFilesOnTheLocalFileSystem
[ July 01, 2008: Message edited by: Ulf Dittmer ]
 
Rancher
Posts: 5008
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I just ran an applet from a jar that I signed and it was able to read a file from my C: drive. It wasn't able to read the file before I signed it.

Here are the commands I used to sign the jar file:


@REM Sign AppletReader.jar to new jar file
@rem commandline used to create keystore:
@echo keytool -genkey -alias signApplet -keypass NormsKey -keystore NormsKS -storepass NormsStore
jarsigner -keystore NormsKS -signedjar sAppletReader.jar AppletReader.jar signApplet



Here's the code in the applet:
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic