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 2 of 3 FirstFirst 123 LastLast
Results 26 to 50 of 55

Thread: Access Denied!

  1. #26
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    Add what to the applet?

    How can the applet carry its permissions with it? Wouldn't that make security useless?


    The .java.policy file is used by the java program to grant permissions to applets.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    How do you do that?
    Where is the user dir?
    Do you have to have every computer to have that file?

  3. #28
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    Google .java.policy and read the doc all about it.

    Correction: the file is in the user.home folder. Use this to find it:
          System.out.println(System.getProperties().getProperty("user.home"));
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    I didn't find it in there?

  5. #30
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    What is the "it" that you did not find?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    I couldn't find the .java.policy file.

  7. #32
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    There isn't one until you create it. Use the policytool program to create one and save it to the user.home folder.
    If you don't understand my answer, don't ignore it, ask a question.

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

    ajayajayaj (February 22nd, 2013)

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

    Default Re: Access Denied!

    I did the all permissions.
    But now I get the error:
    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>
    ----------------------------------------------------
    C:\Users\Ajay
    Exception in thread "AWT-EventQueue-2" java.lang.RuntimeException: could not rename the file C:\users\Ajay\AppData\test\test.zip to C:\Users\Ajay\AppData\Local\Temp\test5089272292711 443389.tmp
    at Main.run(Main.java:131)
    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...

  10. #34
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    java.lang.RuntimeException: could not rename the file C:\users\Ajay\AppData\test\test.zip to C:\Users\Ajay\AppData\Local\Temp\test5089272292711 443389.tmp
    Not sure that error has anything to do with the code being in an applet.
    Try writing a small simple app with the code that created the error.

    Why would there be a problem renaming a file?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    Oh sorry, I moved the file from the folder instead of copying it.
    Now it says the original error:
    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>
    ----------------------------------------------------
    C:\Users\Ajay
    java.io.FileNotFoundException: C:\users\Ajay\AppData\test\test.zip(Access is denied)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at java.io.FileOutputStream.<init>(Unknown Source)
    at UnZipper.extract(UnZipper.java:35)
    at Main.run(Main.java:175)
    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...

  12. #36
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    I don't see anything about permission. Try the code in an app to see what happens there.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    Does trying the code in an app mean making a second applet with just hat code?

  14. #38
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    By app I mean a program that is executed using the java command and that executes without requiring permissions. Code that is not an applet.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    I get the same error!
    java.io.FileNotFoundException: C:\users\Ajay\AppData\test\test.zip (Access is denied)

  16. #40
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    What is there about that file, its state and the OS that would cause the error?

    Can you make a small simple program that compiles, executes and shows the problem for testing?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    For testing purposes, I tried accessing many directories.
    When I even tried just accessing C:\users\<user>\Desktop\ it wouldn't work!

  18. #42
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    Sorry, I don't know what problems the OS can cause when accessing different folders.

    If the program works with some files and folders and not others, then the OS could be causing the problem.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    For some unknown reason, now, I can't access any directory.
    But only with that command.
    I'm using:
    try {
    			FileOutputStream out = new FileOutputStream(new File("C:\\users\\Ajay\\desktop\\"));
    		} catch (FileNotFoundException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
    		}
    Last edited by Norm; February 23rd, 2013 at 02:34 PM. Reason: replaced quote with code tags

  20. #44
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    Please post a complete program that compiles, executes and shows the problem for testing.

    Does that file path exist?


    What error message do you get with the code in post#43?
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    Yes it does exist.
    The error message is:
    java.io.FileNotFoundException: C:\users\Ajay\Desktop (Access is denied)


    --- Update ---

    What do you mean by:
    Please post a complete program that compiles, executes and shows the problem for testing.

  22. #46
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    I changed the path to my desktop and get the same error now.

    See post#42
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    Here is the complete program that compiles, executes and shows the problem for testing:
    public class TestProgram{
    	public static void main(String args[]){
    		try {
    			FileOutputStream test = new FileOutputStream(new File("C:\\users\\" + System.getProperty("user.name")));
    			System.out.println("Success");
    		} catch (FileNotFoundException e) {
    			e.printStackTrace();
    		}
    	}
    }

  24. #48
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    I think that is controlled by the OS. Nothing to do with java.
    If you don't understand my answer, don't ignore it, ask a question.

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

    Default Re: Access Denied!

    I can't find any real reasons why it does that.

    --- Update ---

    Do you know any way I could run this differently?

  26. #50
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    SW Missouri
    Posts
    20,141
    Thanks
    48
    Thanked 2,156 Times in 2,129 Posts

    Default Re: Access Denied!

    If it works for all folders except the desktop, then check the OS's settings for the reason.

    This code works:
          try {
              File fo = new File("C:/users/" + System.getProperty("user.name") + "/Testfile");
              System.out.println("fo="+fo);
    	  FileOutputStream test = new FileOutputStream(fo);
    	  System.out.println("Success");
          } catch (FileNotFoundException e) {
    	   e.printStackTrace(); 
          }
    If you don't understand my answer, don't ignore it, ask a question.

Page 2 of 3 FirstFirst 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