Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

How List the files in directory through Applet code

 
Ranch Hand
Posts: 205
Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a "Test.html" file and other supporting directories in "MyFolder"

In Test.html file I have the following tags with other text..

<applet id="listF" code="AppletClass.class" width="1" height="1">
<param name="archive" value="listfiles.jar">
</applet>

In listfiles.jar, i have a class file called as "AppletClass.class"

In this file (AppletClass.java) I am writing following code

/*where folder1 is one of the dependent folder residing with "Test.html"*/

File f=new file("folder1");
File f1[]=f.listFiles();

After adding these lines i repackaged to jar file and accessed Test.html

Now i am getting the following error..

java.security.AccessControlException:access denied (java.io.FilePermission folder1 read)

I check, the folder doesn't have any permissions.

Please let me know how to list the files and get solution for this problem...
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By default, applets can't access the local file system as a security measure. To get around that, they need to be signed, or the local security policy altered. See HowCanAnAppletReadFilesOnTheLocalFileSystem for details.
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic