Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Read Permission Problem -Access Denied

  1. #1
    Junior Member
    Join Date
    Dec 2012
    Location
    Iran
    Posts
    5
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Read Permission Problem -Access Denied

    Hi
    First of all excuse me if I don't choose proper forum for my question
    I've written an applet with javafx which have to have access to some local file. I have no problem when compile and run it from netbeans BUT when I lunch final .html file or run it from EasyPHP I get access denied error!

    Caused by: java.security.AccessControlException: access denied ("java.io.FilePermission" "posting" "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.FileInputStream.<init>(Unknown Source)
    	at java.io.FileInputStream.<init>(Unknown Source)
    	at java.io.FileReader.<init>(Unknown Source)
    	at temp.MyRead.openFile(MyRead.java:33)
    	at retreival.Indexer.load(Indexer.java:153)
    	at layoutsample.LayoutSample.start(LayoutSample.java:72)
    	at com.sun.javafx.applet.FXApplet2$1.run(FXApplet2.java:132)

    I've eddited java.policy and javafx.policy in my jre and jdk security folder (java 7) in this way :
      permission java.io.FilePermission "C:\\Users\\sara\\Documents\\NetBeansProjects\\LayoutSample\\LayoutSample\\posting", "read";

    but it didn't work !
    Could anyone help me please ? I want to run my app in localhost
    many tnx
    Last edited by ocean1991; December 28th, 2012 at 09:07 AM. Reason: prefix!!


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,322
    Thanks
    56
    Thanked 2,374 Times in 2,345 Posts

    Default Re: Read Permission Problem -Access Denied

    I work with the .java.policy file in the user.home directory using the javapolicy tool that comes with the JDK. My .java.policy file is here:
    C:\Users\Norm\.java.policy

    I do NOT make any changes to files in the JDK or JRE folders.

    What codebase is FilePermission entry in? Here is some of my .java.policy file:
    grant {
      permission java.lang.RuntimePermission "modifyThread";
      permission java.lang.RuntimePermission "loadLibrary.HelloNative";
      permission java.util.PropertyPermission "*", "read";
      permission java.lang.RuntimePermission "modifyThreadGroup";
      permission java.io.FilePermission "E:/Java/Java-1_6_0/docs", "read";
      permission java.io.FilePermission "E:/Java/tutorial", "read";
      permission java.net.SocketPermission "127.0.0.1:3000", "connect, resolve";
    };
    If you don't understand my answer, don't ignore it, ask a question.

  3. The Following User Says Thank You to Norm For This Useful Post:

    ocean1991 (December 28th, 2012)

  4. #3
    Junior Member
    Join Date
    Dec 2012
    Location
    Iran
    Posts
    5
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: Read Permission Problem -Access Denied

    Thank You
    You are right
    I edit my file and it's location according to yours
    It's working now

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    22,322
    Thanks
    56
    Thanked 2,374 Times in 2,345 Posts

    Default Re: Read Permission Problem -Access Denied

    Glad you got it the first try. Usually this problem takes many tries to solve.
    If you don't understand my answer, don't ignore it, ask a question.

Similar Threads

  1. Local Domain MySQL server, access denied
    By techwiz24 in forum JDBC & Databases
    Replies: 1
    Last Post: February 29th, 2012, 11:29 PM
  2. [SOLVED] Access Denied when extracting zip file.
    By techwiz24 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 18th, 2011, 07:50 PM
  3. access denied (java.io.FilePermission "report.jrxml" read)
    By banny7 in forum File I/O & Other I/O Streams
    Replies: 2
    Last Post: November 3rd, 2011, 07:02 AM
  4. JFileChooser save dialog box "access is denied" error
    By byrdman in forum What's Wrong With My Code?
    Replies: 7
    Last Post: August 2nd, 2011, 02:45 PM
  5. Replies: 6
    Last Post: August 18th, 2010, 06:41 PM