Permission to read file

Hello,
I'm developing a class that is supposed to read information from a .txt via Scanner(). The file contents give the program instructions on what to draw in a graphics area. The problem is that I keep an AccessControlException saying access is denied.
The code that read the file is as followed:
import java.awt.*;
import java.io.*;
import java.util.Scanner;
public class Map {
     String mapID;
     Tile[] tiles = new Tile[204];
     public Map(String mapID) {
          this.mapID = mapID;
          this.loadMap();
     public Color loadGraphic(String name) {
          Color graphic;
          if(name == "grass") {
               graphic = new Color(0, 255, 0);
          else if(name == "water") {
               graphic = new Color(0, 0, 0);
          else if(name == "path") {
               graphic = new Color(100, 60, 0);
          else
               graphic = new Color(0, 0, 0);
          return graphic;
     public void loadMap() {
          try {
               Scanner mapFile = new Scanner(new BufferedReader(new FileReader(mapID + ".txt")));
               mapFile.useDelimiter(System.getProperty("line.separator"));
               int i = 0;
               int x = 1;
               int y = 1;
               while(mapFile.hasNext()) {
                    String tile = mapFile.next();
                    if(tile != "") {
                         Point coords = new Point(x++, y);
                         int level = Integer.parseInt(tile.substring(tile.indexOf("["), tile.indexOf("]")));
                         Color graphic = loadGraphic(tile.substring(0, tile.indexOf("[")-1));
                         if(tile.indexOf("(") != -1) {
                              Point teleportTo = new Point();
                              //get point for ()
                              tiles[i++] = new Tile(coords, level, graphic, teleportTo);
                         else {
                              tiles[i++] = new Tile(coords, level, graphic);
                         if(i%17 == 0) {
                              x = 1;
                              y++;
          catch(FileNotFoundException e) {
}The class is designed to be used like Map map = new Map("Map ID");, where Map ID is a string of numbers that directs to a file with that name. For example, Map ID 43253 as a file called 43253.txt that has the instructions in it. The ID I'm using is just 1, and the file contents of 1.txt is just 204 lines that say grass[1]. So the map loader is supposed to read the file and create 204 Tile objects with all the information about it. The class I'm about to show then uses that information to draw, in this case 204 32 x 32 squares of green. Eventually they will be varying colors and tiles and the like, but for now I kept it simple.
package com.momentum.tworeborn;
import java.awt.*;
import java.awt.geom.*;
import javax.swing.*;
public class GraphicsScreen extends JPanel {
     static final long serialVersionUID = 7526471155622776147L;
     public GraphicsScreen() {
          this.setPreferredSize(new Dimension(544, 384));
     public void paintComponent(Graphics g) {
          super.paintComponent(g);
          Graphics2D g2 = (Graphics2D)g;
          Map map = new Map("1");
          int x = 0;
          int y = 0;
          for(int i = 0; i <= 203; i++) {
               g2.setPaint(map.tiles.graphic);
               g2.fill(new Rectangle2D.Double(x, y, x+32, y+32));
               if((i+1)%17 == 0) {
                    x = 0;
                    y += 32;
               else {
                    x += 32;
I'm pretty sore not all of that information was needed, but I just wanted to make sure I gave enough information.
Anyway, as I said, I'm getting a access denied when it tries to read 1.txt. I created the file myself, hand typed it an all. Is there any way to give the program permission to read it?

I'm running it as an applet through Firefox 3.5, on Windows XP.
Edit: I have Service Pack 3 and all that as well. Fully Updated.
Edited by: shadowayex on Jan 8, 2010 8:20 AM

Similar Messages

  • Can't migrate files "don't have permission to read" - how can I reset access?

    Hi,
    I bought a mac mini, the mid 2010 model, it had Snow Leopard. I also have a PowerPC G5 running Leopard. So I migrated my files to the mac mini. Then a week later the new mac mini came out (last week). So, preparing to swap my new old mini for the new new mini I copied all my files BACK to the PowerPC. Got the new new mac mini, and of course it runs Lion. I tried to migrate my files but Lion and Leopard (not Snow Leopard, and it can't be upgraded because it's a PowerPC keep in mind) don't play well with each other. Fine. So I next tried to straight copy the files over my network. No go because I get this message:
    Items can’t be copied to “Desktop” because you don’t have permission to read them.
    I'm using the same login and password on both computers. Both are administrator level. The permissions for the systems themselves have been repaired. I've also tried to set the permissions to the files I want to migrate using this terminal command:
    sudo chown -R yourusername:staff  (and then dragging the folders I want blessed into the window)
    no go... says I don't have permission to do so.
    I tried "pushing" the docs from the other old computer to the new. Doesn't work
    I'm trying copying to the Public folder now - and while it works for MOST of the documents many are still being left behind with the same permissions problem.
    So, here's my question, given I've tried the above: How can you reset an entire folders contents to become absolutely "public"? There must be a way to do this that I'm missing. Again, I already realize I'm copying from different to new computers, but in Lion I can't seem to reset folder permissions to include "all subfolders" or "all files within this folder" (or whatever it used to say).
    Thanks for any suggestions

    Thanks for the help Pondini (gave you a "Helpful Answer" 'star' ). A couple of things, so others have it in front of them:
    Setup Assistant can only be used at first install - otherwise you have to reinstall to use it.
    Second, it's "dumb" that you can't use network between Leopard and Lion. ARGH. - especially since the firewire ports are different on many newer and older macs (and I mean older as in just over 4 years - not that old really). However you can get adapters (that's the next thing to try) that will change the old pin (4 pin I believe) to the newer (9 pin I believe, have to check that one).
    The 501 reference I can check, thanks - I recall seeing that long ago in poking around
    On the Lion machine it reads
    User ID: 501
    Group ID: staff
    On the Leopard  machine I want to copy from TO the Lion machine it reads:
    User ID: 501
    Group ID: 501
    So it seems possible (I'm not sure what I'm seeing - educate me please lol) that the Group ID's don't match, where the Lion machine is staff while the Leopard is '501' - does this matter?
    Thanks.

  • How I can know if a user has the permission to read a file or not ?

    Hello,
    I have other question :
    How I can know if a user has the permission to read a file or not ?
    Smaine
    ThanK's

    I don't think common operating systems have an easy way to do that check.
    If you have a limited number of files, implement access control yourself, instead of using operating system permissions. E.g. write a configuration file that contains:
    # Syntax: "filename": "list of users who can access that file"
    somefile.txt: fred, alice, bob
    somedir/anotherfile.txt: bob, joe
    Read in the configuration file and check against it when a file is being requested.

  • While Installing adobe reader and acrobat im getting error 1406 this error. I had already tried every possible step including special permission in registry file. Please help..

    While Installing adobe reader and acrobat im getting error 1406 this error. I had already tried every possible step including special permission in registry file. Please help..

    What is your operating system?  Is there anything else beside the number 1406?

  • Trying to copy files and getting this error message, One or more items can't be copied because you don't have permission to read them. this is really annoying, can someone pls help..?

    i have two network drive and i am trying to copy a file from my mac mini to one of the network drives, but i keep getting this error message "One or more items can’t be copied because you don’t have permission to read them." i have no idea why this is since i have always been able to copy stuff back and forth. i checked my file sharing permissions and it is set to read and write for admin (me), none for everyone and read for guests. can someone please, this is very annoying and this is the second time it has happened to me.

    neither move nor copy is working. both way gives same error message. what i would like to do however is move the file. yes i am logged in as a the admin and the issue is affecting not just that particular file in my system but others as well. i looked at get info and no the file is not locked but under permission, it says everyone and read only. it will not let me change this setting from get info however when i look under system preferences for file sharing, my setting is read and write for admin (me), none for everyone and read for guests.

  • Getting "don't have permission to read" message transferring file

    hi,
    I'am getting the following window and dialogue when trying to copy a file located on my macbook to a pc running xp on my home network.
    Thoughts?
    "One or more items can’t be copied to “My Documents” because you don’t have permission to read them. Do you want to copy the items you are allowed to read?"
    Thx

    Running disk utility did not fix my problem.
    When I try to copy a file from Mac to XP, I get the dialog that finder wants to change something, and then the alarm that can't copy because I don't have permission to read them. Ugh.

  • When I try to open Itunes it says Library.itl file is locked, on a locked disk, or you do not have permission for this file.  How do I open?  What did my Kid do?

    My daughter added more storage to her cloud while i was at work.  When I came home and tried to get onto Itunes I got the message,'library.itl file is locked, on a locked disk, or you do not have write permission for this file.  I tried uninstalling Itunes on my computer and reinstalled.  After I tried to get in and the same message came up.  I can get onto Itunes on different computers except one.  Any Ideas?

    Hello MF7642,
    Thank you for contacting Apple Support Communities.
    You can use this article to troubleshoot your issues with iTunes.
    iTunes: Missing folder or incorrect permissions may prevent authorization
    http://support.apple.com/kb/TS1277
    Regards,
    Jeff D.

  • TS1717 unes, i have windows 8, i get the message, "the itunes Library .itl file is locked, on a locked disk, or you do not have write permission for this file.  how did this happen, how do i fix this?

    the message"The itun, library .itl file is locked, on a locked disk, or you do not have write permission for this file". i have windows 8. how why did this happen? how do i correct this and prevent another occurance?  I am able to access itunes on my i5, ipad, and my old i4 that i use solely as my ipod now. At the time  problem occurred, i was connected to ext hard drive that hold over 190GB music, to add to my library. I am now unable to add to my library using my laptop.  any advise/help is greatly appreciated!!

    I just had the same problem and was able to fix it after trying a couple of things I found after a search.
    The solution that worked for me:
    Find iTunes folder - it should be in C:\Program FIles (x86) or similar depending on your operating system
    Right click the entire folder (no need to open it) and click properties
    Click the security tab
    Click edit and highlight the user name under which you logged in.
    Click the box next to full in the allow column, which should check everything
    Click apply
    Open iTunes
    This worked for me.

  • How To Fix: "The iTunes Library.itl file is locked, on a locked disk, or you do not have write permission for this file."

    I can't reopen my iTunes after I have to force quit when it does not respond. I get this message:
    "The iTunes Library.itl file is locked, on a locked disk, or you do not have write permission for this file."
    I've read to do the solutions. I right clicked on both the iTunes and Music folder and went to info for each. On both the lock at the bottom of the Get Info was locked. All of my users including admin can read and write all files within those folders. They are even a shared folder. I clicked on the lock to unlock it, typed in my admin password, and went to the gear to apply to all files inside. After doing that I keep getting the saved message.
    I tried another way that I've found online to move my ituneslibrary folder to the desktop and then open my iTunes. In theory the iTunes is supposed to ask for where the iTunes library is. Once that is prompted you quit iTunes and drag the iTunes Library folder back to the folder from the desktop and reopen iTunes to apprently solve the problem. However, when I move the iTunes Library file to the desktop and try to reopne iTunes the icon just keeps bouncing and when I right click the application does not respond.
    This problem is only resolved if I restart/shut down my macbook pro which is a 15-inch Core 2 Duo with intel. It will be 5 years old in December. I currently have Lion and the latest iTunes 10.5. This problem started in late December. 

    If you hold down the option key when starting iTunes, it will allow you to select a library or create a new one.
    You can create a new one, and then add all of your iTunes music back in by simply dragging the old iTunes music file onto iTunes.
    There are more detailed instructions at http://support.apple.com/kb/HT1451#
    It will show you how to re-build your iTunes database file.

  • HT1527 iphone wont open it says the itunes library.itl file is locked on a locked disk or you do not have write permission for this file. nothing l  do seems to help thanks

    Have tried to connect and sync my iphone 4 to my computer in itunes but this message keeps coming up The itunes Library .itl file is locked on a locked disk. or you do not have write permission for this file.

    I have tried both suggestions, unfortunately neither fixed this for me. Hoping there's another possible fix. Thanks in advance. 
    Empty/corrupt iTunes library after upgrade/crash and/or Repair security permissions for iTunes for Windows.

  • Error ORA-20003: Cannot read file/...  in Cash Management?

    Dear All.
    I am having this Error in the Cash Management Module on the bank statement load process
    Error ORA-20003: Cannot read file /software/d01/oracle/interface/finance/inbound/email.9Nemail.13111507.3445704.cnv.
    How do I resolve this error.
    Thank you.

    Hi Lucy,
    The error is probably due to one of the reasons:
    1. There is no file in the location: /software/d01/oracle/interface/finance/inbound/email.9Nemail.13111507.3445704.cnv.
    2. No permission on the file respective file.
    Please get the assistance from the DBA to check on this.
    Thanks &
    Best Regards,

  • I've just opened iTunes on my Mac with an error "The iTunes Library.itl file is locked, on a locked disk, or you do not have write permission for this file.". I created a shirred library so that all users on my Mac can access the same library. Help?

    I have just opened ITunes on my Mac and the following error occurred "The iTunes Library.itl file is locked, on a locked disk, or you do not have write permission for this file.". When I setup my Mac I created a shared user area to contain my ITunes library so that I could share it with another user logged onto my Mac. However the error above gives me the impression that the library file is locked... I've checked and it does not seem to be locked under the "get info" fie information. Has anyone come across this before and found a solution?

    You also need to make sure you have both read and write permission for the file, or for the whole iTunes folder for that matter.  That's also done in Get Info for the file or folder concerned.
    Read the part about changing permissions on the iTunes folder in: https://discussions.apple.com/message/11583914

  • HT203167 I get an error message "The iTunes Library.itl file is locked, on a locked disk, or you do not have write permission for this file."....

    Hi I have downloaded the latest iTune Software on Windows 7. I went to open the file and it won't execute, I small box keeps popping up with this message:-
    "The iTunes library.itl file is locked, on a locked disk, or you do not have write permission for this file".
    I have tried to change the permission but nothing happens. Can anyone please give help me or give me some advise how I can fix this problem.
    Please email me at [email protected]
    Thanking you kindly
    Marina Dunn

    I have tried both suggestions, unfortunately neither fixed this for me. Hoping there's another possible fix. Thanks in advance. 
    Empty/corrupt iTunes library after upgrade/crash and/or Repair security permissions for iTunes for Windows.

  • Error/warning message "you don't have permission to modify files in this network location"

    Hi,
    We have a windows server 2008 running, and we access it via remote desktop. And there's this certain folder that all users access, and where we save important files. So, since this is where important files are stored, we wanted to disable deletion (and if
    possible moving) of the folder and everything under it. However, it's harder than i thought. Right now, we have the permissions "Delete" and "Delete files and subfolders" disabled already, BUT when we try to save a file to this folder,
    we got this warning/error message:
    "You don't have permission to modify files in this network location"
    The file is saved however, but there's no content. But when we try to cut/copy an existing file to this folder, it works.
    Does anyone know how a workaround on this issue. I've already spent days configuring the settings, and when one works, another issue comes up. This is really frustrating.
    Thank you.

    Hi,
    What are NTFS Permissions and Share Permissions of the shared folder? If you remove delete permissions, when someone tried to create a new folder, they couldn't rename it. Without Delete permission, we can open, modify a file and save with the same file name
    but cannot create a new file with a new name.
    For more detailed information, please refer to the thread below:
    NTFS Permissions Question - Allow creation but not deletion
    https://social.technet.microsoft.com/Forums/windowsserver/en-US/3335a9b3-d49a-42f0-970a-3fe44b551274/ntfs-permissions-question-allow-creation-but-not-deletion
    Best Regards,
    Mandy 
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • I receive the follwing error message when trying to open my ipod touch/itunes "the itunes libary.itlfile is lockedon  a lockdisk or you do not have write permission on this file. How do I resolve this problem?

    I receive the follwing error message when trying to open my ipod touch/itunes "the itunes libary.itlfile is lockedon  a lockdisk or you do not have write permission on this file. How do I resolve this problem?

    Repair iTunes Security Permissions
    Right-click on your main iTunes folder and click Properties, then go to the Securitytab and click Advanced. Use the Change Permissions... button grant to your account (or the Users group) and SYSTEM full control of this folder, subfolders and files, then tick the option to Replace permissions entries... which will repair permissions throughout the library. When complete switch to the General tab, click in the Read-only check box to clear it, then click Apply.
    If you don't have the option to change the permissions then use the Owner tab and Edit... button to take ownership from an account with administrator privileges. Tick the option to Replace owner on subcontainers and objects.
    Repeat with the media folder if it isn't stored inside the main iTunes folder.
    If you've brought over the library from another computer you may also want to remove any "mystery" identities (S<string of dashes & digts>) that have come over from the old computer...
    The images above are from Windows 7. Hopefully the system isn't too different in Windows 8.
    tt2

Maybe you are looking for

  • The backlight on my ipod touch 3rd generation will not come on, but everything works perfectly. I even used the advice given on the tech support page, and it still will not come on. HELP ME PLEASE.

    The backlight on my ipod touch 3rd generation will not come on, but everything else is working fine I even took the tech support advice by plugging it in and resetting it, but that didn't fix the issue either. I need help.

  • How to make a webshop in Muse?

    Hi all, A possible new client wants a website with a shop. As I don't have any experience with shopping carts I'm orientating. I wonder for example what's better: integrate an existing html shop in the site or buy a Muse template and stitch them toge

  • JMS JDBC Store in OC4J ?

    Hi, does anybody know if I could configure JMS JDBC Store under OC4J ? It is possible to be done under WebLogic 6.1 (I believe Oracle uses for this purpose Advanced Queue). What about support of other JMS providers, like SonicMQ ? Is it possible to i

  • Pioneer elite plasma connection problem

    I've tried both hdmi outputs on my pioneer tv receiver and i still get no picture. what am i doing wrong?? i've tried switching the outputs with no luck. its a plasma tv with a separate receiver. no hdmi inputs/outputs on plasma unit, only receiver.

  • Fund Control

    Hi Experts, We did an upgrade from 4.6 to v6. In v4.6 we had the function FUND CONTROL (Finance / Treasury / Fund Control) Transactions: FM48 Change Financial Budgeting, FM49 Display, OF22 Create Plan Version, FMP2 Delete Plan Version, Reports: Y_DEV