Reading a data file from an Applet

...new to Applet Programming. I have a stand-alone application that converts
an XML file to a DOM, then to a JTree. I have converted the application to an Applet
But I can't find the trick to having the applet connect to the XML file.
This is the line of code which works fine in the stand-alone, but hangs the Applet:
document = builder.parse( new File( "P6B.Xml" ) );
How can the applet read data located on the host in the same directory as the class?
Sounds simple, but somehow can't find a way of doing this.
One suggested solution (when the file is always needed) I have found browsing
through this site is to wrap both the File and the Class in a JAR.
In this instance, how can I parse the file?
Appreciate any help.

Give the complete URL of your xml file.

Similar Messages

  • Reading Large data files from client machine ( urgent)

    Hi,
    I want to know the best way for reading large data at about 75MB file from client machine and insert to the database.
    Can anybody provide sample code for it.
    Loading the file should be done at client machine and inserting into the database should be done at server side.
    How should i load the file?
    How should i transfer this file or data to server ?
    How should i insert into the database ?
    Thanks in advance.
    regards
    Kalyan

    Like I said before you should be using your application server to serve files >from the server off the filesystem. The database should not store files this big >and should instead just have a reference to this file. I think u have not understood the problem corectly.
    I will make it clear.
    The requirement is as follows.
    This is a j2ee based application.
    Application server is oracle application server.
    Database is oracle9i
    it is thick client (swing based application)
    User enters datasource like c:\turkey.data
    This turkey.data file contains data
    1@1@20050131@1@4306286000113@D00@32000002005511069941@@P@10@0@1@0@0@0@DK@70059420@4330654016574@1@51881100@51881100@@99@D@40235@0@0@1@430441800000000@@11@D@42389@20050201@28483@15@@@[email protected]@@20050208@20050307@0@@@@@@@@@0@@0@0@0@430443400000800@0@0@@0@@@29@0@@@EUR
    like wise we may have more than 3 lacs rows in it.
    We need to read this file and transfer this to the application server. Which are EJBS.
    There we read this file each row in file is one row in the database for a table.
    Like wise we need to insert 3 lacs records in the database.
    We can use Jdbc to insert the data which is not a problem.
    Only problem is how to transfer this data to server.
    I can do it in one way. This is only a example
    I can read all the data in StringBuffer and pass to server.
    There again i get the data from StringBuffer and insert into database using jdbc.
    This way if u do it. It is performance issue and takes long time to insert into the database.It even may give MemoryOutofBond exception.
    just iam looking for the better way of doing this which may get good performace issue.
    Hope u have understood the problem.

  • Reading and writing to a text file from an Applet

    I'm a novice java programming with very little formal programming training. I've pieced together enough knowledge to do what I've wanted to do so far...
    However, I've been unable to figure out how to read and write to a text file from an Applet (I can do it from a normal java program just fine). Here is a simple example of what I'd like to do (you can also look at it on my website: www.stat.colostate.edu/~leach/test02/test02.html). I know that there is some problem with permission/security but I'm not smart enough to understand what the error messages are telling or understand the few books I have. If anyone can tell me how to get this applet to work, or direct me to some referrences that would help me out I'd really appreciate it.
    Thanks,
    Andy
    import java.applet.Applet;
    import java.net.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.util.*;
    import java.io.*;
    public class test02 extends Applet {
    public Button B_go;
    public GridBagConstraints c;
    public void init() {
    this.setLayout(new GridBagLayout());
    c = new GridBagConstraints();
    c.fill = GridBagConstraints.BOTH;
    B_go = new Button("GO");
    c.gridx=1; c.gridy=0; c.gridwidth=1; c.gridheight=1;
    c.weightx = c.weighty = 0.0;
    B_go.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
    setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
    print_stuff();
    setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
    this.add(B_go,c);
    public static void print_stuff() {
    try{
    File f = new File("test02.txt");
    PrintWriter out = new PrintWriter(new FileWriter(f));
    out.print("This is test02.txt");
    out.close();
    }catch(IOException e){**/}
    }

    I have almost the exact same problem, and I am in the same situation as you are with respects to the language.
    I am simply trying to create a file and output some garbage to it but my applet always spits back a security violation. I've tried eliminating the restrictions on the applet runner I use but I still get the error.
    My method:
    debug = new Label() ;
    debug.setLocation( 20, 20 ) ;
    debug.setSize( 500, 15 ) ;
    add( debug ) ;
    // output
    try
         OutputStream file = new FileOutputStream( new File( "" + getCodeBase() + "output.txt" ) ) ;
         byte[] buffer = { 1, 2, 3, 4, 5 } ;
         file.write( buffer ) ;
         file.close() ;
    } catch( Exception e )
         debug.setText( e.toString() ) ;
         Can anyone tell why this isnt working?

  • How to read a local file from Applet Code

    Hi
    I am developing a application and i want to access a local file from the applet
    So pls help me in coding for this

    You can't do that, at least not with an unsigned applet.
    Sign your applet and it should work just like normal file access.

  • How do I update a file in an Applet's JAR file from the Applet code

    Here's my problem.
    My applet is using a serializable history data in which I am storing in the applet's JAR file. When I run the applet, I read the file with "getResourceAsStream()" and run my program with that hist data. When my applet is closed, I need to update this file from my Applet's code and I dumfounded about how to do that.
    Is there any way to update a file in the Applet's JAR file through the Java Applet code? (i.e. OutputStream?).
    Would appreciate any advice people have.

    Just place a copy of the file on the local hard disk and update that. When you start the Applet you try to read from the hard disk. If the file exists then no problem otherwise copy it from the jar to the hard disk.

  • Using files from an applet

    Hello !
    I know it is impossible to write files from an applet for security reasons, but I "only" need to read some data from files.
    My applet works perfectly with the appletviewer, but when I try from IExplorer, it reacts as if the files were missing. In fact, I think it is a poblem with the location...where could I find the files ? What path do I have to mention in my code ?
    I tried to use a .jar archive, putting all my .class and data files in that archive, but it still doesn't find the data files.
    Thanks for you help.
    C14

    There's just as much security about reading files from an applet, otherwise a hidden applet on a web page could read the files on your PC and transmit your secrets to some web site.
    You [i[can[/i] write applets to read (and write) files on the local machine but they need to be digitally signed.
    If the files you want to read are just parameters etc. then the best thing is to put them where you put your html and read them through a URL connection. That's allowed.

  • Unable to delete data files from my Ipod if used as data storage...

    Hello everybody
    I bought months ago an Ipod Nano 8GB. I've got an issue when i use it as disk storage i'm not able to sort out. I've checked all the topics but i cannot find any solution.
    Example: I use the Ipod with the option "Manually manage music and videos". I put audio and video files on my Ipod through Itunes, then i put also some files on my Ipod as normal data files through my Mac Finder (Easy, i drag VLC, JPG files etc. from folders to my Ipod). The Ipod/Itunes summary page shows (Correctly) the capacity column colored in blue (Audio), video (Purple) and orange (Data). No probs when i transfer data files to another computer.
    Problem: when i delete the data files from my Ipod (Through finder) the orange column doesn't disappear (I have no problems if i delete audio/video files via Itunes) and although i've actually deleted all the files if i try to add some other data or videos/music files to my Ipod, Itunes says that there is no space available in my device. It's very strange, i check and double check all the options but eventually i have to restore my Ipod all the times and (Pretty annoying) add all my files again.
    It seems that although i sent my files to the trash bin, Itunes (Fully updated) doesn't recognize the change.
    It'd be great if someone can help me out as it's very important for me to be able to use my Ipod as disk storage, thanks a lot!

    It seems that although i sent my files to the trash bin, Itunes (Fully updated) doesn't recognize the change.
    Empty it from the Finder menu or by control-clicking it in the Dock.
    (44613)

  • Pulling data file from FTP server

    Hello All,
    I would require help on how to read a data file stored in FTP server from my ABAP program. The type of file is .csv, I need this file to actually upload the data coming into SAP. Please suggest how do I solve this.
    Thanks,
    Sunil Kumar

    hi,
    You will find the link useful...
    http://www.sap-img.com/ab003.htm
    Also, check out the standard program ... RSEPSFTP
    The flow should be..
    Open a FTP connection by FM- FTP_CONNECT
    Execute a command on the FTP server by FM - FTP_COMMAND
    and finally  Close the connection by FM - FTP_DISCONNECT
    Regards,
    Richa

  • Read a zip file from Application server.

    Hi,
    Is there a way to read a zip file from the applicatoin server to internal table in ABAP program?  The operation system is running MS windows server.  The zip file contains only 1 text file.  I tried to use open dataset 'uncompress', and use read dataset, but read dataset gave me sy-subrc = 4.  Any feedback is greatly appreciated.
    Thanks.

    hi,
    to convert xstring to text you can use this:
    DATA unzipped_data TYPE xstring.
    DATA text_data TYPE string.
    DATA conv_x2c TYPE REF TO cl_abap_conv_in_ce.
    conv_x2c = cl_abap_conv_in_ce=>create( ).
    conv_x2c->convert( EXPORTING input = unzipped_data IMPORTING data = text_data ).
    moreover, if you want to split your text at "end of line" (CR LF in microsoft windows) into lines:
    DATA text_lines TYPE TABLE OF string.
    SPLIT text_data AT cl_abap_char_utilities=>cr_lf INTO TABLE text_lines.

  • How to read the data file and write into the same file without a temp table

    Hi,
    I have a requirement as below:
    We are running lockbox process for several business, but for a few businesses we have requirement where in we receive a flat file in different format other than how the transmission format is defined.
    This is a 10.7 to 11.10 migration. In 10.7 the users are using a custom table into which they are first loading the raw data and writing a pl/sql validation on that and loading it into a new flat file and then running the lockbox process.
    But in 11.10 we want to restrict using temp table how can we achieve this.
    Can we read the file first and then do validations accordingly and then write to the same file and process the lockbox.
    Any inputs are highly appreciated.
    Thanks & Regards,
    Lakshmi Kalyan Vara Prasad.

    Hello Gurus,
    Let me tell you about my requirement clearly with an example.
    Problem:
    i am receiving a dat file from bank in below format
    105A371273020563007 07030415509174REF3178503 001367423860020015E129045
    in this detail 1 record starting from 38th character to next 15 characters is merchant reference number
    REF3178503 --- REF denotes it as Sales Order
    ACC denotes it as Customer No
    INV denotes it as Transaction Number
    based on this 15 characters......my validation comes.
    If i see REF i need to pick that complete record and then fill that record with the SO details as per my system and then submit the file for lockbox processing.
    In 10.7 they created a temporary table into which they are loading the data using a control file....once the data is loaded into the temporary table then they are doing a validation and updating the record exactly as required and then creating one another file and then submitting the file for lockbox processing.
    Where as in 11.10 they want to bypass these temporary tables and writing it into a different file.
    Can this be handled by writing a pl/sql procedure ??
    My findings:
    May be i am wrong.......but i think .......if we first get the data into ar_payments_interface_all table and then do the validations and then complete the lockbox process may help.
    Any suggestions from Oracle GURUS is highly appreciated.
    Thanks & Regards,
    Lakshmi Kalyan Vara Prasad.

  • How do i move a data file from my pc to my ipad

    How do I move a data file from my computer to my ipad? It is my product catalogue and it would help if it were on my ipad.

    Plug the iPad into iTunes and you can use file sharing to move it into an app that supports file sharing and that document format.
    see http://support.apple.com/kb/ht4094
    Or, use an online storage service (iCloud, dropbox, box, google drive, sugarsync, etc) and upload the file to that.  Then on the iPad, from within the app you plan to use the file with, link to that service and download the file.
    The app will again have to work with that file type, and support the particular service you used.

  • Reading an XML file from package .....

    I m trying to read an xml file from a package. The XML file is located on desktop (not on unix system). if i mention the path of the file in a package, is it sufficient ???. OR do i need to CREATE DIRECTORY in oracle and mention the file path in this directory ???
    If not any suggestion or advice is great ???

    Depends upon the version of Oracle being used. Going from memory, I think it started with 10g that you had to CREATE DIRECTORY and then use that object in references to disk. It could have been 9i as I skipped that version. If you look at the documentation for whatever provided procedure you are calling it will tell you what it expects.
    As the code runs on the server the DB resides on, the data file will need to be network accessible from there in order for your code to read the file.

  • Reading a CSV file from server

    Hi All,
    I am reading a CSV file from server and my internal table has only one field with lenght 200. In the input CSV file there are more than one column and while splitting the file my internal table should have same number of rows as columns of the input record.
    But when i do that the last field in the internal table is appened with #.
    Can somebody tell me the solution for this.
    U can see the my code below.
    data: begin of itab_infile occurs 0,
             input(3000),
          end of itab_infile.
    data: begin of itab_rec occurs 0,
             record(200),
          end of itab_rec.
    data: c_comma(1) value ',',
            open dataset f_name1 for input in text mode encoding default.
            if sy-subrc <> 0.
              write: /, 'FILE NOT FOUND'.
              exit.
            endif.
    do
      read dataset p_ipath into waf_infile.
      split itab_infile-input at c_sep into table itab_rec.
    enddo.
    Thanks in advance.
    Sunil

    Sunil,
    You go not mention the platform on which the CSV file was created and the platform on which it is read.
    A common problem with CSV files created on MS/Windows platforms and read on unix is the end-of-record (EOR) characters.
    MS/Windows usings <CR><LF> as the EOR
    Unix using either <CR> or <LF>
    If on unix open the file using vi in a telnet session to confirm the EOR type.
    The fix options.
    1) Before opening the opening the file in your ABAP program run the unix command dos2unix.
    2) Transfer the file from the MS/Windows platform to unix using FTP using ascii not bin.  This does the dos2unix conversion on the fly.
    3) Install SAMBA and share the load directory to the windows platforms.  SAMBA also handles the dos2unix and unix2dos conversions on the fly.
    Hope this helps
    David Cooper

  • Using Migration Assistant to Move Data Files from one Account to New User

    Is it possible or recommended to use Migration Assistant to move data files from an old user account to a new user account on the same volume/hard disk?

    Migration Assitant cannot be used as a simple file transfer utility. MA can transfer an entire Home folder or entire Users folder but not individual files.
    In general files in one user account cannot be moved to another user account as this would violate built-in security measures.
    What you can do is to copy the files to an external device like a hard drive or flash drive. First log in to the old account. Then configure the drive to ignore preferences by Pressing COMMAND-I to open the Get Info window and check the Ignore permissions on this volume checkbox at the bottom of the window. Copy your files to the device. Log into the new account. Verify the external drive is still configured to ignore permissions (reset it, if not.) Copy the files from the external device into the Home folder of the new account. I would create a temporary folder for these files. If you still end up without the proper permissions you will need to make modifications that are easier done if all the files are in a single folder.

  • I have iphoto '08 version with an imac osx 10.5.8. It will not read my RAW files  from my Nikon D800 - a very new model.How can I get it to read my RAW files?

    my somewhat old imac osx 10.5.8 with iphoto '08 will not read my RAW files from my new Nikon D800 camera - a new model on the market( 5 months or so). How can I get iphoto to read my RAW  files?

    iPhoto 08 would not read RAW files from that new a camera. You need to upgrade so you can get more up-to-date version of OS X and iPhoto. Another possiblity is see if iPhoto 11 will run on 10.5.8, if so you should update. You can also attempt to run Software Update and see if it finds a newer release of iPhoto 08 that supports newer RAW formats.

Maybe you are looking for