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.

Page 1 of 3 123 LastLast
Results 1 to 25 of 55

Thread: Access Denied!

  1. #1
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Access Denied!

    Whenever I try accessing the appdata folder from my applet it gives me the following error:
    java.io.FileNotFoundException: C:\users\<user name>\AppData\Roaming\test\test.class (Access is denied)
    Any help?


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    Applets are not allowed to access files on the machine it is executing on.
    They can get files from the server they were loaded from.

    Can you explain in more detail what you are trying to do?
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    The problem is it even gives the error when in applet simulator.

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    What is the applet simulator?
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    I meant the applet viewer in eclipse.

    --- Update ---

    Also, I have heard that you have to sign your jar. I'm wondering how you do that.

  6. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    sign your jar. I'm wondering how you do that.
    Ask google. Signing a jar is a multi-step process.

    See the tutorial: http://docs.oracle.com/javase/tutori...tFunction.html
    If you don't understand my answer, don't ignore it, ask a question.

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

    ajayajayaj (February 20th, 2013)

  8. #7
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    Thanks, but it still gives me the access denied error.

  9. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    You were able to sign the jar file in 20 minutes?

    How do you use a jar file with AppletViewer?
    If you don't understand my answer, don't ignore it, ask a question.

  10. #9
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    It just shows a white square for my applet when I run it in a webpage.

  11. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    it keeps giving me this error
    what is the "it"?
    If you don't understand my answer, don't ignore it, ask a question.

  12. #11
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    Sorry, I mean it just shows a white square for my applet when I run it in a webpage.

  13. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    What is shown in the browser's java console?
    If you don't understand my answer, don't ignore it, ask a question.

  14. #13
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    How do you get that?

    I'm on Google chrome by the way.

  15. #14
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    There is a setting via the Java icon in the Control Panel on Windows.
    If you don't understand my answer, don't ignore it, ask a question.

  16. #15
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    I can't find the button.

  17. #16
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    Where did you look?
    If you don't understand my answer, don't ignore it, ask a question.

  18. #17
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    Well, I selected Advanced Then selected show console.
    But where is the cosole?

  19. #18
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    Mine comes in the upper left of the screen when I open a page with an applet.
    If you don't understand my answer, don't ignore it, ask a question.

  20. #19
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    On what browser?

  21. #20
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    Chrome and Firefox
    If you don't understand my answer, don't ignore it, ask a question.

  22. #21
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    It said:
    Java Plug-in 10.15.2.03
    Using JRE version 1.7.0_15-b03 Java HotSpot(TM) Client VM
    User home directory = C:\Users\Ajay
    ----------------------------------------------------
    c: clear console window
    f: finalize objects on finalization queue
    g: garbage collect
    h: display this help message
    l: dump classloader list
    m: print memory usage
    o: trigger logging
    q: hide console
    r: reload policy configuration
    s: dump system and deployment properties
    t: dump thread list
    v: dump thread stack
    x: clear classloader cache
    0-5: set trace level to <n>
    ----------------------------------------------------
    Exception in thread "AWT-EventQueue-2" java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.name" "read")
    at java.security.AccessControlContext.checkPermission (Unknown Source)
    at java.security.AccessController.checkPermission(Unk nown Source)
    at java.lang.SecurityManager.checkPermission(Unknown Source)
    at java.lang.SecurityManager.checkPropertyAccess(Unkn own Source)
    at java.lang.System.getProperty(Unknown Source)
    at Main.run(Main.java:96)
    at Main.paint(Main.java:59)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at javax.swing.JLayeredPane.paint(Unknown Source)
    at javax.swing.JComponent.paintChildren(Unknown Source)
    at javax.swing.JComponent.paintToOffscreen(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paintDoubl eBuffered(Unknown Source)
    at javax.swing.RepaintManager$PaintManager.paint(Unkn own Source)
    at javax.swing.RepaintManager.paint(Unknown Source)
    at javax.swing.JComponent.paint(Unknown Source)
    at java.awt.GraphicsCallback$PaintCallback.run(Unknow n Source)
    at sun.awt.SunGraphicsCallback.runOneComponent(Unknow n Source)
    at sun.awt.SunGraphicsCallback.runComponents(Unknown Source)
    at java.awt.Container.paint(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at javax.swing.RepaintManager$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(Unknown Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unkno wn Source)
    at javax.swing.RepaintManager.paintDirtyRegions(Unkno wn Source)
    at javax.swing.RepaintManager.prePaintDirtyRegions(Un known Source)
    at javax.swing.RepaintManager.access$1000(Unknown Source)
    at javax.swing.RepaintManager$ProcessingRunnable.run( Unknown Source)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$200(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPri vilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilter s(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(U nknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarch y(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
    Repeats...


    --- Update ---

    Also, what I understood from the link you gave me was you have to add the text:
    <script src=
    "http://www.java.com/js/deployJava.js"></script>
    <script>
    var attributes = {code:'<whatever>.class',
    archive:'<whatever.jar>.jar',
    width:710, height:540} ;
    var parameters = {fontSize:16} ;
    var version = '1.7' ;
    deployJava.runApplet(attributes, parameters, version);
    </script>
    to run the applet instead of the normal code.
    Last edited by ajayajayaj; February 21st, 2013 at 07:05 PM. Reason: Repeats

  23. #22
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    java.security.AccessControlException: access denied ("java.util.PropertyPermission" "user.name" "read")
    The applet does not have the permission it needs.

    I've never used JNLP. I've only used the <applet tags.
    If you don't understand my answer, don't ignore it, ask a question.

  24. #23
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    So how do you give it the permission?

  25. #24
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,009
    Thanks
    47
    Thanked 2,138 Times in 2,111 Posts

    Default Re: Access Denied!

    My applets that require permission are only executed on my pc. I use the .java.policy file to grant permissions.
    Here is a sample 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";
    };

    grant codeBase "file:/D:/JavaDevelopment/Testing/WriteFile/-" {
    permission java.io.FilePermission "D:/Testing/*", "read, write";
    };
    I use the policytool to edit it. It is located in the user.dir folder.
    If you don't understand my answer, don't ignore it, ask a question.

  26. #25
    Member
    Join Date
    Feb 2013
    Posts
    40
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Default Re: Access Denied!

    So you add that to your applet?

Page 1 of 3 123 LastLast

Similar Threads

  1. Read Permission Problem -Access Denied
    By ocean1991 in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: December 28th, 2012, 09:38 AM
  2. Local Domain MySQL server, access denied
    By techwiz24 in forum JDBC & Databases
    Replies: 1
    Last Post: February 29th, 2012, 10:29 PM
  3. [SOLVED] Access Denied when extracting zip file.
    By techwiz24 in forum What's Wrong With My Code?
    Replies: 1
    Last Post: December 18th, 2011, 06:50 PM
  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, 01:45 PM
  5. Replies: 6
    Last Post: August 18th, 2010, 05:41 PM

Tags for this Thread