Need help reading files from a simple applet

hi everyone,
i have the following problem while trying to read from a file:
java.security.AccessControlException: access denied (java.io.FilePermission dr.xml read)
this problem shows up only when loading applet from a browser... if i use appletviewer everithing is ok.
this is the code:
        cycle = new String[2];
        phase = new String[8];
        v = new Vector();
        int temp;
        try {
            try {
                fis = new FileInputStream("dr.xml");
                while ((temp = fis.read()) > 0) {
                    buf += (char) temp;
                fis.close();
                fis = null;
            } catch (java.io.FileNotFoundException ex) {
                System.out.println("File does not exist. ");
        } catch (java.io.IOException ex) {
            System.out.println("error. ");
            ex.printStackTrace();
        }thanks

You don't have access to the file system. Think about it, you visit a web page and an applet starts reading your files? That's a HUGE security risk.
That said, I think you can do this if you have a signed/trusted applet. Google "signed applets" and "certificates"

Similar Messages

  • Need help reading file directory from applet!

    Hi i am writing a java applet which has to read in several text files from its codebase directory. I have this code at the moment which causes a nullpointerexception:
    public void initTables()
            File dir = new File(getCodeBase().getPath());
            File[] files = dir.listFiles();
            for (int i = 0; i < files.length; i++)//null pointer here
                String fileName = files.getName();
    if(fileName.endsWith("set.txt"))
    fileName = fileName.substring(0, (fileName.length() - 4));
    Table t = new Table(this, fileName);
    }Anybody know whats going on here?
    thanks                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Sorry i thought it was a null pointer, it's actually this:
    java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Emud\Documents\pokemon 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.File.list(Unknown Source)
         at java.io.File.listFiles(Unknown Source)
         at Gui.initTables(Gui.java:75)
         at Gui.init(Gui.java:16)
         at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)
    Exception: java.security.AccessControlException: access denied (java.io.FilePermission C:\Users\Emud\Documents\pokemon read)
    yeah, i'm making a program about pokemon...cos i'm cool 8)

  • NEED HELP GETTING FILES FROM ITUNES ON ONE COMPUTER TO THE OTHER.

    So I was using a PC to backup my iphone 5 to itunes; however, i just bought a macbook pro and it wont let me transfer the files from one computer to the other and i need help!

    Click here and pick the option which best fits your situation.
    (93771)

  • New mac user needs help transfering files from Dell...

    I have a Dell running Windows XP and need help transfering the files from the dell to the mac.
    Also I have no idea what OP system I have, how do you tell which one you have???

    Go to the blue Apple menu and scroll down to "About this Mac"
    In the summary window that opens you will find the following information:
    Mac OS X version (assuming you are running OS X)
    Processor speed.
    Memory
    Startup disk
    The More Info button will take you to an in-depth overview of hardware, network set-up and installed software.
    As far as transference is concerned, you can either transfer files via CD, DVD, external hard drive... or by networking the two computers.
    Here's a link for an overview concerning Mac to PC connectivity:
    http://docs.info.apple.com/article.html?artnum=19652
    I hope the above helps.
    Reagrds
    Tony
    G5 iMac, G4PB, iMac DVD 450Mhz   Mac OS X (10.4.2)  

  • Need Help:Reading Data from RU payroll cluster for table GRREC

    Hi...
    I need help on how to read data from RU cluster table for table GRREC for the employee & run date and get the value from structure PC292 .
    Please let me know about the includes and the import and export statements to be used.
    Thanks in advance,
    RAVI.

    Hi,
    Here goes pseudocode
    Includes:
    include: rpppxd00    ,
                rpppxd10     ,
                rpc2cd09     , 
                rpc2rx02_ce , "if ldb pnp_ce is used else use the same include with out _ce
                rpc2rx29      ,  
                rpc2rx39      ,
                rpppxm00    ,
                rpc2ruu0_ce ,
    Declare:
    DATA : i_rgdir   LIKE pc261        OCCURS 0 WITH HEADER LINE     ,
               i_result  TYPE pay99_result OCCURS 0 WITH HEADER LINE ,
               i_grrec   LIKE  pc292           OCCURS 0 WITH HEADER LINE .
    start-of-selection:
    GET pernr.
    Get the RGDIR VALUE for the current PERNR & selected Molga
    get rgdir data TABLES i_rgdir
                          USING pernr-pernr
                                     p_molga " parameter
    CD-KEY-PERNR = PERNR-PERNR.
    RP-IMP-C2-CU.
    i_rgdir [] = rgdir[].
      LOOP AT i_rgdir WHERE fpbeg  LE  pn-endda
                        AND fpend  GE  pn-begda
                        AND srtza  EQ 'A'
                        AND void   NE   'V'.
      get_result_tabs   TABLES i_result
                                   USING 'RU'    "  US cluster
                                         pernr-pernr
                                         i_rgdir-seqnr
          RX-KEY-PERNR = PERNR-PERNR.
          UNPACK i_RGDIR-SEQNR TO RX-KEY-SEQNO.
          RP-IMP-C2-RU.
      i_grrec[] = i_result-inter-grrec[].
      LOOP AT i_grrec.
      case i_grrec.
      use wage types required here and pass the data to output table.
      endcase.
      endloop.
      endloop
    end-of-selction.

  • I need help transferring files from a locked admin account

    I was having trouble connecting to my school's wifi because I couldn't remember my admin password to authenticate the changes. I created a new admin account, and connected to the wifi. I didn't realize by doing this all of my files would be on the old admin account. Now I am completely locked out of the account, and need help getting my files off of it! Any ideas?

    Migrating from PPC Macs to Intel Macs:
    https://discussions.apple.com/docs/DOC-2295
    http://support.apple.com/kb/HT4796
    and this article:
    http://www.macworld.co.uk/mac/news/?newsid=3444778&olo=email

  • Need help transferring files from my canon vixia hg21 to final cut express!

    I can't seem to get my camera or its files to show up on the FCE log and transfer window. If anyone knows of a way to get this to work i would greatly appreciate it!!!. also, I have already tried converting files to get them to be an agreeable format for FCE but the end result is always low quality.

    HI -
    Log and Transfer only works with HD material, so make sure you shot in the HD mode.
    Also, some times if there are multiple file formats on the same camera storage, like HD clips, SD clips and still images, this can prevent Log and Transfer from working properly. If that is the case, see if you can off load and delete all the non-HD material from the camera storage so that only HD material is there.
    Then:
    Open FCE.
    Open the Log and Transfer window.
    Click on the little gear shaped icon towards the upper middle of the L&T window
    !http://www.spotsbeforeyoureyes.com/L%26TPrefs.jpg!
    Select Preferences from the drop down menu.
    When the preference window opens, set the AVCHD Plug-In audio format to Plain Stereo.
    !http://www.spotsbeforeyoureyes.com/L%26TPrefsToPlainStereo.jpg!
    Close Log and Transfer and close FCE.
    Now connect your camera via USB with the camera on, open FCE and then open Log and Transfer and see if the window populates with clips.
    Hope this helps.
    MtD

  • NEED HELP:reading output from ms-dos program (with exec)

    I'm trying to execute an ms-dos program using exec,
    and reading it's output.
    the program is running ,but, I can't see it's output.
    I've tried many variations of this code:
    Process p = Runtime.getRuntime().exec("file_name");
    try { p.waitFor();}
    catch(Exception e) {}
    BufferedReader input = new BufferedReader(new InputStreamReader(p.getInputStream()));
    String line;
    while((line = input.readLine()) != null )
    please help mewith this - thanks, froy
    System.out.println(line);
    System.out.println(p.exitValue());

    try { p.waitFor();}This doesn't return until the exec process has finished running. So there is no stream for it to get anything from.

  • Need to read data from pipe separated file using POJO?

    Hi,
    I need to read data from pipe separated file using POJO.
    There is config.properties file which consists of the
    data mapping.
    Can you help me with sample code or help?
    Regards
    Regards
    Taton
    Edited by: Taton on Mar 7, 2009 4:41 PM

    It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
    [http://java.sun.com/docs/books/tutorial/essential/io/]
    *Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need to read data from a text file

    I need to read data from a text file and create my own hash table out of it. I'm not allowed to use the built in Java class, so how would I go implementing my own reading method and hash table class?

    It's not possible to read from a file without using classes from the core API*. You'll have to get clarification from your instructor as to which classes are and are not allowed.
    [http://java.sun.com/docs/books/tutorial/essential/io/]
    *Unless you write a bunch of JNI code to replicate what the java.io classes are doing.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Need help reading burn CDR mp3 and dvdrw from my superdrive

    my Super Drive was fine untill i upgrade to Maverick now it wouldnt  read the music on all of my burn cdr disk and dvdrw . ALso .need help  reading my external 2TB External Ntfs Hard drive.....

    To many conflicting information...
    my Super Drive was fine untill i upgrade to Maverick
    Per your system profile: "Mac mini, Mac OS 9.1.x"
    Mac Minis do not have a superdrive.  You also posted in the Intel iMac forums.
    Please correct and/or update so that you will be provided w/the correct troubleshooting suggestions.

  • Open Data Set Error while trying to read file from non SAP server

    Hi all,
    is it possible to read data from non-SAP application Sever?
    I'm using OPEN DATASET p_filin FOR INPUT IN LEGACY TEXT MODE CODE PAGE '1504',
    Where p_filin is other Windows server.Our applicition server is under Unix.Is it a problem?
    I make test to read file from SAP application server and it was ok.So how to call other server?
    Thanks!

    Hi,
    Yes it is possible to read data from a non SAP server through the statement OPEN DATASET.
    The important thing to check is that the SAP Server got enough access to the non SAP server so it can perform a reading/writing process depending on your needs.
    You should contact your network administrator and BASIS to help you check the permissions. This can be pretty tricky, specially if the servers are in different domains.
    Regards,
    Gilberto Li

  • Reading files from phone memory

    Hi All,
    I am developing a Universal application using vs 2013 in windows phone 8.1. I am stuck in finding and reading file from phone memory.
    I have used the Localfolder syntax
    StorageFolder folder = Windows.Storage.ApplicationData.Current.LocalFolder;but it didn't worked. Its Showing the application data. But i want to read the file exixts in my phone memory.Then i have usedStorageFolder file = KnownFolders.DocumentsLibrary;but as i read from the forums its not suggested way to approach. Please suggest me the way to find the file from phone memory and to read it.Any help would be appreciatable!!

    Hi sarika,
    That is expected, see the documentation for more information:
    App capability declarations at Documents section, you need declared at least a file type association.
    Furthermore You can't use the Documents library in a Windows Phone Store app.
    You can't publish a Windows Phone Store app that specifies the documentsLibrary capability to the Windows Phone Store. The Store blocks the publishing of the app.
    Your app can't access the Documents library in the phone's internal storage. If another app creates a Documents folder on the optional SD card, however, your app can see that folder.
    --James
    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.
    Click
    HERE to participate the survey.

  • Reading files from a browser on clients PC

    is there anyway to read files from clients PC through browser in java, apart from signed applets.....
    plz help , its very urgent......

    taking the browser to be IE, suppose the following situation:
    a web application is running on client PC, and on click of a button, i have to generate a report in some format and insert some images in that report which are on clients local drive and their path is known to me say C:\ myimage.jpg.
    if the mages were on the server(where web application is hosted), then its not a prob.[b]
    so for doing such a thing what i have to do means, what setting i have to change of the browser .....what security setting of clients PC has to be changed...
    and how to get jar signed.
    plz tell me the procedure to do this....

  • PI sender communication channel not reading files from NFS directory

    Hello,
    I have a sender communication channel configured to read file from NFS directory which is on ECC server. A program in ECC generates the file and puts it on the ECC server in the output directory. PI sender communication channel is supposed to pickup this file and process it. If I give the NFS path as the source directory, I am getting error: Configured source directory '//Server/DIR/OUT' does not exist. I tried putting '
    Server\DIR\OUT' too but same error. Do I have to add the NFS path of ECC into PI as logical path?
    Any suggestions?
    Thanks,
    Sangita

    Hello Sangita,
    Your ECC server is an external system, therefore you need to activate FTP service in that system and use the transport protocol FTP:
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/content.htm
    You can use NFS protocol when you have a local directory in XI server.
    Best Regards,
    .Luis Bernal.

Maybe you are looking for

  • PLEASE HELP- flashing question mark in folder

    Hi everyone, last night I was just on my macbook as usual and suddenly it froze, so I turned it off. When i went to turn it back on, all that appeared was a flashing question mark in a folder. I have tried all the suggestions on this page http://docs

  • Safari 2.0.3 page moves on restart

    Usualy after restart my Safari window has moved to the right a bit, so I have to reposition it. Corrupted preferences? Is there a way I can fix this without losing all my settings and bokmarks?

  • PaintComponent method doesn't display anything on JLabel?

    I am trying to show a histogram for a image in jlabel, but its not working. //hist : array containing histogram values //wid: width of image //ht: height of image mylabel.add(new showData(hist,wid,ht)); The code that I am using to display histogram i

  • Reusing charts in a case structure

    I have a chart on the front panel. I need to output tuples to it in two different cases (in the same case structure). How does one do it without creating copies or running into naming conflicts ? 

  • One arm Cisco ASA deployment

    Hello guys, Would it be possible to deploy Cisco ASA like Cisco VPN 3000 which connecting only one interface to DMZ interface of the firewall? I?d like to use it for remote access IPSec VPN. I?m looking for any documents regarding this configuration