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)

Similar Messages

  • 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"

  • Need help getting files names from directory

    I have never done anything in php before and I'm struggling.
    In an attempt to search through potential document names in a directory, I've added the following code to a new php document:
    <?php
    if ($handle = opendir('.')) {
        while (false !== ($file = readdir($handle))) {
            if ($file != "." && $file != "..") {
                echo "$file\n";
        closedir($handle);
    ?>
    with no luck. When executed all I get is a blank screen. Any ideas why?
    End goal is to list the file names in the directory so that the user can choose to open desired document. Thanks!

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

  • Need help reading the info from GSpot...

    I've got an uncompressed .mov file that someone exported from FCP (not sure which version) for me to put a new music bed on and upload to our website. I attempted to import it PrPro, but it failed to import and gave me an unknown codec error. I opened the file in GSpot and got the below screenshot, which I don't really know how to read properly. I also tried repackaging the file using MPEG Streamclip, but got a file with audio and no video... Help?

    Thanks, Bill... here's the info from MediaInfo (I don't own QT Pro):
    General
    Complete name                    : F:\PCI\MLK\MLK Day 2012\Barber_MLKDay_sans_music.mov
    Format                           : MPEG-4
    Format profile                   : QuickTime
    Codec ID                         : qt 
    File size                        : 3.31 GiB
    Duration                         : 4mn 32s
    Overall bit rate mode            : Variable
    Overall bit rate                 : 104 Mbps
    Encoded date                     : UTC 2012-01-20 00:24:50
    Tagged date                      : UTC 2012-01-27 16:13:10
    Writing library                  : Apple QuickTime
    ©TSC                             : 2997
    ©TSZ                             : 100
    Video
    ID                               : 1
    Format                           : Intermediate Codec
    Codec ID                         : icod
    Codec ID/Hint                    : Apple
    Duration                         : 4mn 32s
    Bit rate mode                    : Variable
    Bit rate                         : 103 Mbps
    Width                            : 1 920 pixels
    Height                           : 1 080 pixels
    Display aspect ratio             : 16:9
    Frame rate mode                  : Constant
    Frame rate                       : 29.970 fps
    Scan type                        : Interlaced
    Scan order                       : Top Field First
    Bits/(Pixel*Frame)               : 1.655
    Stream size                      : 3.26 GiB (99%)
    Language                         : English
    Encoded date                     : UTC 2012-01-20 00:24:50
    Tagged date                      : UTC 2012-01-20 00:31:22
    Color primaries                  : BT.709-2, SMPTE 274M, SMPTE 296M
    Transfer characteristics         : BT.709-2, SMPTE 170M, SMPTE 274M, SMPTE 293M, SMPTE 296M
    Matrix coefficients              : BT.709-2, SMPTE 274M, SMPTE 296M
    Audio
    ID                               : 2
    Format                           : PCM
    Format settings, Endianness      : Little
    Format settings, Sign            : Signed
    Codec ID                         : sowt
    Duration                         : 4mn 32s
    Bit rate mode                    : Constant
    Bit rate                         : 1 536 Kbps
    Channel(s)                       : 2 channels
    Sampling rate                    : 48.0 KHz
    Bit depth                        : 16 bits
    Stream size                      : 49.9 MiB (1%)
    Language                         : English
    Encoded date                     : UTC 2012-01-20 00:24:50
    Tagged date                      : UTC 2012-01-20 00:31:22
    Menu
    ID                               : 3
    Duration                         : 4mn 32s
    Language                         : English
    Encoded date                     : UTC 2012-01-20 00:31:22
    Tagged date                      : UTC 2012-01-20 00:31:22

  • 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.

  • I need help burning a cd from keynote

    I need help burning a cd from keynote for a slideshow presentation on a tv

    Hi,
    Not quite sure what you're after here, so I might need a bit more info.
    You have a presentation in Keynote and want to export this in some format that will allow you to display it on a TV screen. Is this right? Do you want to retain all your interactivity or do you just want to show it as a simple 'kiosk' presentation? What will the presentation on CD be played from and how will it connect to the TV?
    Probably the easiest solution is to create a DVD of your presentation. To do this export the presentation from Keynote as a Quicktime Movie by going to File>Export and selecting the Quicktime pane. You'll need to make a few choices about how the slides are advanced and the final quality. Convert the exported movie to a DVD in iDVD or better still Toast, if you have it. You wont need menus or any fancy stuff, just set up the movie to play as soon as the disk is inserted.
    To optimise the Movie, keep Keynote animations to a minimum and limit slide transitions to simple dissolves. The resulting Movie should be a fair representation of the original Keynote presentation.
    Alastair.

  • I need help to create  idoc from scrach.

    i need help to create  idoc from scrach.

    Swamy Katta,
    Please read "[the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement]" before you post any further, and confirm that you have read them?
    => Search first, ask questions later please!
    Julius

  • Error while reading file entries from the database

    Hi there,
    We are running a instance of xmii 12 in a VM (VMware) and after somebody shutdown the host machine without shutting down the VM (great idea isn't it?) we keep getting this message when trying to access xMII:
    "Application cannot be started.
      Details:   com.sap.engine.services.deploy.container.ExceptionInfo: Error while reading file entries from the database."
    Any clue? Any suggestion on how we can recover from that?
    Thanks a whole lot,
    Dom
    Server log:
    #1.5 #000C29A3B1F20002000000C400000F2800044829A35270F8#1205243578005#/System/Server##com.sap.engine.services.dbpool.deploy.ContainerImpl####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.dbpool.deploy.ContainerImpl#Plain###DataSources or DataSource aliases of 'sap.com/tcmonitoringsysteminfo' application started successfully.#
    #1.5 #000C29A3B1F20002000000C500000F2800044829A3527A6C#1205243578005#/System/Server##com.sap.engine.services.servlets_jsp.server.container.WebContainer####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.servlets_jsp.server.container.WebContainer#Plain###application [] Start of application [sap.com/tcmonitoringsysteminfo] finished successfully on Web Container.#
    #1.5 #000C29A3B1F20002000000C600000F2800044829A3527DB5#1205243578005#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.deploy#Plain###
    Operation startApp over application sap.com/tcmonitoringsysteminfo finished successfully on server 305221750#
    #1.5 #000C29A3B1F20002000000C700000F2800044829A3527E03#1205243578005#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.deploy#Plain###
    Operation startApp on application sap.com/tcmonitoringsysteminfo finished on current cluster node for 221 ms.#
    #1.5 #000C29A3B1F20002000000C800000F2800044829A3528B49#1205243578005#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Error#1#com.sap.engine.services.deploy#Plain###Error occurred while initially starting application sap.com/xappsxmiiear:Error while reading file entries from the database.#
    #1.5 #000C29A3B1F20002000000CA00000F2800044829A352922B#1205243578015#/System/Server##com.sap.engine.services.deploy####n/a##60152160ef7211dcb7a5000c29a3b1f2#SAPEngine_System_Thread[impl:5]_17##0#0#Info#1#com.sap.engine.services.deploy#Plain###The synchronization of applications with DB completed for 39304 ms.#
    #1.5 #000C29A3B1F200040000000200000F2800044829B290A4F8#1205243834341#/System/Server/SLDService##com.sap.sldserv.DataCollector####n/a##0da42150ef7311dcb908000c29a3b1f2#SAPEngine_System_Thread[impl:5]_7##0#0#Warning#1#com.sap.sldserv.DataCollector#Plain###Communication configuration is incomplete. No data transfer possible until corrected.#

    Well thanks for the hint. Actually, the DB was up but corrupted. I managed to solve the bug by re-deploying xMII (using the SDM tool) which kept all my data but redeployed both the config db of (x)mii and the class files.

  • I am setting up a new iMac and need help syncing files to Dropbox.  On my old computer I had it set where when I saved a document, it was saved on my hard drive, as well as to a folder in Dropbox.  I can't remember how I set this up.  Any help?

    I am setting up a new iMac and need help syncing files to Dropbox.  On my old computer I had it set where when I saved a document, it was saved on my hard drive, as well as to a folder in Dropbox.  I can't remember how I set this up.  Any help?

    The way that Dropbox works is that it keeps a copy of all your files in your local Dropbox folder on your hard drive (which is, by default, directly under your home folder). Adding files to that folder will sync them to the Dropbox server.
    You do of course have to download the Dropbox application to enable this (download link at the top right of http://dropbox.com ).
    Matt

  • I need help to transfer CS4 from a dead G5 to a new Macbook Pro. Can't find my program discs but purchased CS4 in 2008 and have record of it.

    I need help to transfer CS4 from a dead G5 to a new Macbook Pro. Can't find my program discs but purchased CS4 in 2008 and have record of it.

    Sounds like you got it installed and activated. Don't forget your updates.
    Adobe - Photoshop : For Macintosh
    Gene

  • Need help moving videos/photos from Galaxy S4 to iMac

    need help moving videos/photos from Galaxy S4 to iMac
    Samsung's utility Kies is awful
    Hlpe please

    did this
    import photos from android to mac
    got this, try it
    http://www.phototransferapp.com/help/android/transfer_photos_from_your_android_t o_your_mac/
    or use the first link to try some of the google hits for ways to get photos from android devices into osx

  • 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)

  • Need help reading a text file!!!!

    What i need is a simple example of how to read data
    from a text file into a applet
    so i can put the values in the file into a array
    the file will be in the same folder as the the applet
    say i have a file myfile.txt with the following values written in it
    5
    10
    15
    20
    i want to read them into a simple array myarray[]
    for later use
    everything ive tryed wont work and i havent gotten a response in the the new to java forum

    //set up file reader
    java.io.BufferedReader in = new java.io.BufferedReader( new java.io.FileReader("myfile.txt") );
    //set up vector as we dont know how many lines there are in file
    java.util.Vector vect = new java.util.Vector();
    //store lines in vector
    while(in.ready())
    vect.add( in.readLine().trim() );
    //close file
    in.close();

  • 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)  

  • Urgent!!! Need help in file read/write data to a serial port

    Hi,
    I really need someone's help in order for me to complete my project. I have attached a vi which I have taken from an example and integrate to my project. In the vi, I have managed to get the encoder counts using Ni 9411. I need to read/write that data from ni9411 to ni9870 without using any serial port as they are connected to a NI 9104 chasis. May I know whether I am correct in writing the data to my ni9870 port using the vi I have attached? Does anyone know how i can convert the number of counts to a 8-bit data/byte so that I can send the data through the RS232 port? I really need someone's help as I need to finished in 2 weeks time.
    I have also attached an vi on controlling the epos2 controller using instrument driver. Does anyone know how can i integrate this vi to the fpga vi (the one which I need to read/write data to 9870) as I need to send those data to control my epos2 controller.
    Please help me!!!
    Attachments:
    Encoder Position & Velocity (FPGA).vi ‏23 KB
    SINGLEMOTORMODIFIED.vi ‏17 KB

    Afai,
    As I allready suggested you here, call your local NI Office and ask for assistance!
    You really need assistence in a higher level that we can provide via the forums. Otherwise I don't see a chance for you to finish your project in time.
    1. Convert I32 to U8 to write it to the 9870 could be done like this:
    2. The vi to control the epos2.
    There is NO way ( absolutely NO way) to port this vi to FPGA. It's based on VISA calls, uses an event-structure, both are not available at the FPGA.
    The only thing you could do is to analyze the VI, the instruction set and design an FPGA vi which handles the specific instructions you would need.
    I have no experience with epos2 and I'm not 100% sure if this would work as you would like to use it. And doing this needs deep knowledge of LabVIEW, VISA, Instrument Drivers, the epos hardware, FPGA programming, and so on... 
    Christian

Maybe you are looking for

  • How can I display content blocked by an invalid security certificate?

    I am using Firefox 30.0 which I installed to replace IE8. I log in to my health insurance site. When I try to go to the Provider Directory Search (PDS), nothing happens. I thought the PDS might be a pop-up so I tried both making the web page a pop-up

  • Recording from

    Audigy2 Plat How do I record audio from the Headphone out of TV to Creative player/recorder. Not sure which input on Li've Dri've to record to. Rex.

  • Hot Backup Query

    Hi, I was under the impression that while doing hot backup, one must maintain all the archive logs since the start of the backup, in order to be able to restore the backup. However, recently when I did a restore of my hot backup, it asked me for arch

  • Can you hyperlink to a section of a smooth scrolling article?

    I have a folio that uses smooth scrolling instead of page scrolling.  The page is really long so I want to create a jump to menu that will jump down the page to the desired section.  I thought that creating a text anchor destination would work, but a

  • Evaluating PL/SQL

    I am doing some work on evaluating PL/SQL using XML and i had to devise a means of evaluating PL/SQL. The evaluation has to be similar to the ones i have provided below. I am not sure if these suggestions are correct but i hope to put the evaluation