Help reading a .txt file from the hard drive....

Hi guys,
Ok... I need to know how to read a .txt file from the hard drive... I have an example on how to read from a disk, but I don't have a disk drive. I could be confusing terminology, but I don't think I am. Here is the code I have for reading from a disk.. please let me know how I should change it to read from a hard drive.
Also, when the error pops up, it says that it can't read another .txt file that is not specified in the code... any ideas how that is occuring? Please advise.
import java.io.*;
public class TEST {
public static void main(String args[]) throws Exception{
FileReader fr = new FileReader("customer.txt");
BufferedReader bfr = new BufferedReader (fr);
String s;
while ((s=bfr.readLine())!= null){
System.out.println (s);
fr.close();
}

Ok... I need to know how to read a .txt file from the
hard drive... I have an example on how to read from a
disk, but I don't have a disk drive. I could be
confusing terminology, but I don't think I am. Here
is the code I have for reading from a disk.. please
let me know how I should change it to read from a
hard drive.The code will be the same, regardless of where the file is located. It's just the filename that will be different.
Also, when the error pops up, it says that it can't
read another .txt file that is not specified in the
code... any ideas how that is occuring? Please
advise.Probably becuase the class file (compiled version of the source code) is a different version to the source code, i.e. the source code hasn't been recompiled since the source code was changed.
How does this relate to EJBs?

Similar Messages

  • The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? is there a cable i can connect to another mac that will let me transfer the file?

    The circuit of my macbook is dead yet the hard drive is fine.  I need to access a file from the hard drive, how can i do this? The mac turns on the screen freezes as bright blue.  Is there a cable i can connect to another mac that will let me transfer the file?

    There is another option if the Macbook will start up in Target Disk Mode.
    Restart the computer while holding down the T key. If you see the firewire symbol moving around on the screen you can connect this one to another one in TDM. You will need a suitable cable to connect the two Macs.
    http://support.apple.com/kb/ht1661
    Firewire symbol:

  • I'm a beginner with iMovie and my hard drive is filling up fast. How do I move the event files from the hard drive to my time capsule?

    I'm a beginner with iMovie and my hard drive is filling up fast. How do I move the event files from the hard drive to my time capsule?

    you should never (ab)use a designated backup-setup for 'ordinairy' storage tasks.
    plus, the wireless connection to TC is too slow for iMovie.
    purchase any ext. usb-harddrive, 500Gigs starting at 50$ ...
    you HAVE to follow advice given here:
    http://help.apple.com/imovie/#mov3ac6d42c

  • Palm Zire 31 sat idle for too long and then my hard drive crashed - I have recovered my palmOne files from the hard drive but don't know how to install to desktop?

    Since this product is no longer supported by the manufacturer, I hope that someone out there will be able to help me find a way to get my calendar and contacts restored to the desktop.  My handheld sat unused for a very long time, but my desktop calendar and contacts were current up until my hard drive crashed.  I was able to recover the PalmOne files from the crashed hard drive but all I can see are *.dat files.  When I try to import or restore, the *.dat is not a supported file extension.  HELP!  I have the original installation CD. Thank you
    Post relates to: Zire 31
    This question was solved.
    View Solution.

    .dat are the actual working files Palm Desktop is looking for - you can't import them.
    Just create a user in Palm Desktop and copy the .dat files (that have more than 1k of data) over the existing address.dat and datebook.dat (or calendar.dat, I forget which existed on your device).
    WyreNut 
    I am a Volunteer here, not employed by HP.
    You too can become an HP Expert! Details HERE!
    If my post has helped you, click the Kudos Thumbs up!
    If it solved your issue, Click the "Accept as Solution" button so others can benefit from the question you asked!

  • I am having difficulty getting to grips with the mac book pro.  I needs some training - does anyone know if Apple provides a free course when you buy a laptop?  I am having difficulty moving files from the hard drive to an external drive.

    Does Apple provide a free course for new Macbookpro users?  In Dubai?
    I have downloaded files on to the hard drive and cannot move them on to an external drive.  I have now lost my document folder from the status bar, although I can see it in finder.  How do I get my 'document' file back and in place on the status bar.  I tried to drag and drop it into the external drive - but failed and lost it to what appears to be space!  Please help - many thanks.  Maddy

    maddysams wrote:
    Does Apple provide a free course for new Macbookpro users?  In Dubai?
    I have downloaded files on to the hard drive and cannot move them on to an external drive.  I have now lost my document folder from the status bar, although I can see it in finder.  How do I get my 'document' file back and in place on the status bar.  I tried to drag and drop it into the external drive - but failed and lost it to what appears to be space!  Please help - many thanks.  Maddy
    Hi Maddy,
    Here's some Online Help for Getting you Started using your MBP
    Mac 101
    http://www.apple.com/support/mac101/
    http://www.apple.com/support/switch101/     Switching from PC
    MBP Support
    http://www.apple.com/support/macbookpro
    Apple Videos
    http://support.apple.com/videos/
    Cheers,  

  • How do I get all the files from the hard drive in non-working Compaq Presario CQ62-411NR

    Spilled iced tea into the keyboard of notebook and after drying out it will not power on. If I try a hard restart it is indicated that i would lose all the info in the memory and I can not afford to lose the photos of my mother that are on the hard drive. Is there a way of getting the hard drive to work in some other fashion so that I can get my photos and other files.
    This question was solved.
    View Solution.

    Very happy to help.Valued family photos are a treasure.
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

  • I had to transferr my music files from one computer to another by directly copying the files from the hard drive to a new drive.  Itunes recognized the files and I was able to load in new songs.  The new songs won't sync with ipod.  Ideas?

    To copy the files I had to remove the hard drive and direct copy them to an expansion drive on another machine.  ITunes recognized the copied files and operates correctly on the computer.  I was able to download additional songs to ITunes on the computer without problem.  The IPod however will not recognize the new songs, does an abreviated sync process and gives a message that the IPod cannot sync because files are being used by another application.  It is also does not want to accept the disconnect command.  Any suggestions on how to solve the sync problem?

    how did you save the songs? can you play the songs? have you restarted the computer?

  • How to delete other files(yellow color code) from the hard drive, how to delete other files from the hard drive

    how can i delete the yellow color code items from my hard drive? What are these other files anyway? I wanna save some memory space from my storage.

    Macbook Pro community is here
    Following thread could solve your question.
    https://discussions.apple.com/message/19030300#19030300

  • What is the best way to remove files from the hard drive?

    I'm donating one of my computers, and there are certain sensitive files (bank records, etc.) I need to remove. I want them completely removed to the point it's like they never existed, so any hard drive recovery tools can never find them.

    Then you will have to get a replacement set from Apple.
    Since the DVD are your license to OS X they really should be included with the Mac when you sell it.
    Allan

  • Can I trash a file from the hard drive after importing into iMovie HD 6?

    I created some DV video files using MPEG Streamclip. I imported them into iMovie HD 6. Can I now put those DV files in the trash and empty the trash, to free up disk space, and still be able to do whatever I want with them in iMovie HD 6?

    Yes, if you don't have another drive to store them on.

  • Problem with LR5 Import on MAC, it always shows "file cannot be imported because it could not be read" This happens with file downloads from the memory card as well as with files from the hard drive. Happened out of the blue and I cannot figure out why. P

    I need some instructions to solve this problem, has anyone had the same problems? We just got an imac and changed from windows to mac. At first LR worked perfectly, all of a sudden I cannot import pictures anymore. Please help!!

    The destination directory, where Lightroom is trying to copy photos to, does not have WRITE permission. Change your permissions.

  • "Bad data format" when reading txt file from the presentation server

    Hello,
    I have a piece of code which reads a txt file from the presentation server to an internal table like below:
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME              = lv_filename
    CHANGING
       DATA_TAB            = lt_tsd. " lt_tab has the exact same fields as the Test.txt's. Test.txt has only one line, tab delimited.
    When running this code, exception BAD_DATA_FORMAT is issued.
    Is it because of the file encoding or delimiter or other reason?
    Thanks,
    Yang

    Hello,
    If its tab delimited then use the has_field_seperator parameter and check
    DATA : lv_filename type string.
    lv_filename = 'C:\abap\Test.txt'. "I created a folder called abap under C:\
    CALL method CL_GUI_FRONTEND_SERVICES=>GUI_UPLOAD
    EXPORTING
       FILENAME                = lv_filename
       FILETYPE                 = 'ASC'
       HAS_FIELD_SEPARATOR          = u2018Xu2019
    CHANGING
       DATA_TAB            = lt_tsd.
    Vikranth

  • My operating system has just vanished !! The laptop turns on but dose not go past the apple logo and I really need my files from my hard drive ASAP ??

    My laptop had lost it's operating system,it turns on and the logo comes up with the spinning wheel And that's as far as it goes, I can not get into safety mode. I can not open my bios and I desperately need by collage files from the hard drive. Please help!!

    Try booting in Safe Mode.  
    17" 2.2GHz i7 Quad-Core MacBook Pro  8G RAM  750G HD + OCZ Vertex 3 SSD Boot HD 

  • How to read an audio file from the disk and play it?

    Do you know who to read an audio file from the hard disk and play it. It's for an application and not an applet. I tried with the Applet.newAudioClip(URL url) thing, but I keep getting a MalformedURLException.
    And is there a way to get the path of the file you are using? Currently I'm doing this:
    File file = new file("randomname");
    string = file.getAbsolutePath();
    file.delete();
    I'm sure there's a better way. And this is not for an applet, just a normal app.

    Below is a class that should be of use to you.
    package com.sound;
    import java.io.File;
    import javax.sound.sampled.AudioFormat;
    import javax.sound.sampled.AudioInputStream;
    import javax.sound.sampled.AudioSystem;
    import javax.sound.sampled.Clip;
    import javax.sound.sampled.DataLine;
    public class SoundPlayer implements Runnable {
         String filename;
         public SoundPlayer(String filename){
              this.filename = filename;
              Thread t = new Thread(this);
              t.start();
         }//SoundPlayer constructor
         public void run(){
              playSound();
         }//run method
         public boolean playSound(){
              try {
                   File file = new File(filename);
                   AudioInputStream stream = AudioSystem.getAudioInputStream(file);
                   AudioFormat     format = stream.getFormat();
                   DataLine.Info info = new DataLine.Info(Clip.class, format);
                   Clip clip = (Clip)AudioSystem.getLine(info);
                   clip.open(stream);
                   clip.start();
                   while (clip.isRunning()) {
                       Thread.sleep(100);
                   clip.close();
              catch (Exception e) {
                  System.err.println("Error in run in SoundPlayer");
                   return false;
              return true;
         }//playSound() method
    }//Class SoundPlayer

  • [SOLVED] How to Restore Folders/Files from a Hard Drive

    I broke my system today; it won't boot into any run level. Rather than try to fix it, I'd like to just pull off the 4 or 5 MB of files that are on the hard drive. The partition they are in was formatted XFS. I have the 2008.06 ArchLive CD - is it possible to access files from the hard drive after booting with an ArchLive CD? If so, I could just scp them to an external server. Any help is greatly appreciated. Thanks.
    Last edited by tony5429 (2008-09-28 04:52:39)

    You should be able to mount the partition once you've loaded up the live CD. Just figure out which one it is by using
    fdisk -l
    then mount it to /mnt or wherever you want it.
    As for moving/saving them, I'm not entirely sure how to get them onto an external server. You might have to mount another partition in order to install any apps that you need to connect to an external server, but wait for someone who really knows to answer before you try it. If you're only talking about 4 or 5 MB, I would just mount a USB stick and dump them on there.
    Last edited by Xyne (2008-09-28 03:38:02)

Maybe you are looking for

  • My Safari 6 crashes every time I open it - bad window/site?

    Hello all, My Safari 6 crashes every time I try to open it.  It initially crashed on a bad site that was trying to run some sort of suitability check (java, etc.) and now it seems that Safari attempts to reopen that link when I re-invoke it.  I'm not

  • Photoshop cs4 crashes when i open a file

    whenever i open a file the following error comes and the application crashes Problem signature:Problem Event Name: APPCRASH Application Name: Photoshop.exe Application Version: 11.0.0.0 Application Timestamp: 48d3882e Fault Module Name: CoolType.dll

  • Mac office 2008......

    Hey all, i'm just about to buy office 2004 for my macbook...can anyone explain what the difference with the office 2008 that was announced today??i basically just need it for word(writing essays) and powerpoint(class presentations)but at the same tim

  • Missing Pre-order DLC for Bloodborne

    Hi, I pre-ordered Bloodborne for PS4.  I did it online with in-store pick-up on release.  I searched the receipt, emails, account info on my online account and don't see a code anywhere.  I put a link to the item I was supposed to get below: http://w

  • Overwriting a part of a text file?

    Hi, i am writing an application where i can set markers on a waveform graph, now i want to write the values of the markers in a text-based file (spreadsheet) I make one file with several markers, but it happens that i want to overwrite a part of the