Results 1 to 13 of 13
Like Tree1Likes
  • 1 Post By Norm

Thread: permissions Exception in applet

  1. #1
    jiji2663 is offline Member
    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0

    Exclamation permissions Exception in applet

    java.security.AccessControlException: access denied ("java.io.FilePermission" "c:\1\a.txt" "read")

    permissions Exception in applet-2013-12-17-12-49-57.png
    I have an applet wich read a file on the client.

    public class MyApplet extends Applet {
    public static void main(String[] args){
    JFrame frame = new JFrame();
    MyApplet inst = new MyApplet();
    frame.getContentPane().add(inst);
    ((JComponent)frame.getContentPane()).setPreferredS ize(inst.getSize());
    frame.pack();
    frame.setVisible(true);
    }
    public MyApplet()
    {
    initGUI();
    }
    public String readFile() {

    String thisLine, ret = "";
    String fn="c:\\1\\a.txt";
    try {
    FileInputStream fin = new FileInputStream(fn);
    BufferedReader myInput = new BufferedReader
    (new InputStreamReader(fin));
    while ((thisLine = myInput.readLine()) != null) {
    ret += thisLine + "\n";
    }
    } catch (Exception e) {
    ret = e.toString();
    }
    return ret;
    }
    please help me i signed applet

  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,090
    Rep Power
    6

    Default Re: permissions Exception in applet

    - does the file actually exist?
    - does your system user (or the user that is used to run Java) actually have read access permissions to that file?
    - how did you sign your applet? Self-signed? Or are you using a valid license that is not expired?
    - you did put the signed applet on the server right? You did not leave an older copy there.
    - the browser is not running an old cached version of the applet right? You cleared any caches?

    And in case nothing of the above is helpful in any way: detail the steps you used to actually sign the applet and which version of Java is used to run the applet.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  3. #3
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,562
    Rep Power
    25

    Default Re: permissions Exception in applet

    Also explain how the applet is being executed. Where does it live and where is it executed?
    gimbal2 likes this.
    If you don't understand my response, don't ignore it, ask a question.

  4. #4
    jiji2663 is offline Member
    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0

    Default Re: permissions Exception in applet

    i use this applet in asp.net

    <applet id="MyJavaApplet" height="0" width="0"
    code="org.me.hello.MyApplet"
    archive="ap/Shelloapplet2000.jar">
    <param name="msg" value="fgf"/>
    </applet>

    and use javascript to get value in text files:

    <script type="text/javascript">

    function btnNetMessage_onclick() {
    var message1 = MyJavaApplet.readFile();
    alert(message1);
    }
    </script>

    and with below link toturial to sign applet:
    How to sign a Java applet - Blogs - Java Programming Forum - Learn Java Programming

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,562
    Rep Power
    25

    Default Re: permissions Exception in applet

    Sorry, I don't know what asp.net is.
    Are you saying that the applet is on a internet site controlled by a server
    and that you load a html page from that site in a browser on your PC
    and that the html page includes the <applet tag that you posted?

    Do you know about the java page in the Control panel? Have you adjusted the security level for applets?
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,090
    Rep Power
    6

    Default Re: permissions Exception in applet

    Yes you see but that article is from 2011 and in recent versions of Java the rules have changed a lot. That's why I asked you all other kinds of questions which you really should answer.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  7. #7
    jiji2663 is offline Member
    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0

    Default Re: permissions Exception in applet

    Quote Originally Posted by Norm View Post
    Sorry, I don't know what asp.net is.
    Are you saying that the applet is on a internet site controlled by a server
    and that you load a html page from that site in a browser on your PC
    and that the html page includes the <applet tag that you posted?

    Do you know about the java page in the Control panel? Have you adjusted the security level for applets?
    yes,my applet in html pages inside applet tag

    i don't known about java in control panel

  8. #8
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,562
    Rep Power
    25

    Default Re: permissions Exception in applet

    The Control Panel is for a Windows OS. It has icons to control many features on Windows.
    If you don't understand my response, don't ignore it, ask a question.

  9. #9
    jiji2663 is offline Member
    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0

    Default Re: permissions Exception in applet

    - does the file actually exist?
    yes,file is exist

    - does your system user (or the user that is used to run Java) actually have read access permissions to that file?
    yes,have access,i test this applet in my system and get error

    -how did you sign your applet? Self-signed? Or are you using a valid license that is not expired?
    sign applet with this article:
    How to sign a Java applet - Blogs - Java Programming Forum - Learn Java Programming

    - you did put the signed applet on the server right? You did not leave an older copy there.
    yes
    - the browser is not running an old cached version of the applet right? You cleared any caches?
    i cleared chache,but get same error

    And in case nothing of the above is helpful in any way: detail the steps you used to actually sign the applet and which version of Java is used to run the applet.
    permissions Exception in applet-2013-12-18-10-29-51.png

    when html page is loaded i get the below warning:
    permissions Exception in applet-2013-12-18-10-33-35.png

    and when click on the run and click on button for call method ReadFile get another warning
    permissions Exception in applet-2013-12-18-10-36-27.png
    <br/>
    permissions Exception in applet-2013-12-18-10-36-59.png
    when click on allow, i get the error
    permissions Exception in applet-2013-12-17-12-49-57.png

  10. #10
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,562
    Rep Power
    25

    Default Re: permissions Exception in applet

    What is the Security setting in the Java Control Panel?
    Attached Thumbnails Attached Thumbnails permissions Exception in applet-javacp.png  
    If you don't understand my response, don't ignore it, ask a question.

  11. #11
    DarrylBurke's Avatar
    DarrylBurke is offline Forum Police
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,423
    Rep Power
    20

    Default Re: permissions Exception in applet

    The forum is where you ask for help. Not the PM system.

    db

    Quote Originally Posted by jiji2663
    please help me to sovle applet error

    my problem:
    permissions Exception in applet
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  12. #12
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,090
    Rep Power
    6

    Default Re: permissions Exception in applet

    Quote Originally Posted by DarrylBurke View Post
    The forum is where you ask for help. Not the PM system.

    db
    You were not the only one to get that spam.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  13. #13
    jiji2663 is offline Member
    Join Date
    Dec 2013
    Posts
    5
    Rep Power
    0

    Default Re: permissions Exception in applet

    Quote Originally Posted by Norm View Post
    What is the Security setting in the Java Control Panel?
    medium

Similar Threads

  1. jre 7u45 Applet has an exception
    By snowjo502 in forum Java Applets
    Replies: 5
    Last Post: 03-07-2014, 10:11 AM
  2. JAVA Permissions Applet
    By Magnos in forum New To Java
    Replies: 9
    Last Post: 10-01-2013, 10:09 AM
  3. Applet Blocked Exception
    By allaudin in forum New To Java
    Replies: 0
    Last Post: 08-17-2013, 05:48 AM
  4. Replies: 1
    Last Post: 02-05-2013, 07:36 PM
  5. don't have permissions
    By Petr in forum Suggestions & Feedback
    Replies: 4
    Last Post: 06-12-2011, 04:38 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •