Win a copy of Zero to AI - A non-technical, hype-free guide to prospering in the AI era this week in the Artificial Intelligence and Machine Learning 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
  • Liutauras Vilda
  • Paul Clapham
  • Bear Bibeault
  • Jeanne Boyarsky
Sheriffs:
  • Ron McLeod
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • salvin francis
  • Scott Selikoff
  • fred rosenberger

AccessControlException

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

I have an java applet program that will use java IO to read and write local file. I know I need to grant rights to the client from "java.policy" file in order to bypass this( java.security.AccessControlException: access denied (java.io.FilePermission c:\item.txt write)) exception. I am currently using IBM WSAD 5.1.2 to write my applet code. I put the following code inside java.policy file(s), where BookStore folder contains all of my java files, and I would like to have to access right to read and write to the client's local files.




since IBM WSAD has a few java.policy files, and I am currently using their base_v5 library, so i modified all the java.policy under "$IBMWSAD"\eclipse\jre\lib\security\java.policy",
"$IBMWSAD\runtimes\base_v5\java\jre\lib\security\java.policy"
and also create ".java.policy" using command "policytool".

However, what I did is vain and the applet from the "sun java console" still gives me java.security.AccessControlException: access denied (java.io.FilePermission c:\item.txt write) when I try to write some data to the file. why? what's wrong with my work? I really feel fraustured at it and I hope I can get help from you guys

THanks in advance

Transistor
 
Rancher
Posts: 43016
76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Those two paths look like they have something to do with WSAD, which may not be the same JVM that is being used to run applets. (I would imagine that WSAD likes to use an IBM JVM, while your posts talks about the "Sun Java console".)

Check the Java Plugin control panel for which JVM is used for applets, and put the policy file in its repective directory.
 
Opportunity is missed by most people because it is dressed in overalls and looks like work - Edison. Tiny ad:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic