Help saving a .txt file to Netbeans Project Folder

I'm a newbie and need some help doing this. The program simply won't read it from outside of Netbeans apparently... it makes since, but I'm still miffed. Anyhow... any help you can offer would be greatly appreciated... this is my first programming class and I'm really nervous about this not working.
Here is the code that I have so far, please let me know if you see anything that would not let it read in addition to the not being saved correctly part.
import java.io.*;
public class assignment3{
public static void main(String[] args) {
String fileName = "customer.txt";
try {
FileReader fr = new FileReader(fileName);
BufferedReader bfr = new BufferedReader(fr);
for (;;){
String line = bfr.readLine();
if (line == null) {
break;
System.out.println(line);
fr.close();
}catch (Exception e){
System.out.println("Could not read from file:"+ fileName);
Thanks,
goodgirlSLCL

Another post that's got nothing to do with EJBs ;-)
The filename ("customer.txt") is relative to the NetBeans project folder. If you want it to read another file, elsewhere on the disk, you need to specify the absolute path to it. For example "C:/Documents and Settings/etc/etc/etc/".

Similar Messages

  • Soucre sharing - does a netbeans project folder contains any personal info?

    Hi, the netbeans board here was closed and the only thing I can find at netbeans is a mailing list. I hope its ok to post this here.
    I want to make make my source available to others, is it safe/ok to tar the entire netbeans project folder or can it contain any personal info?
    Is there a plug in that can do this in a good way?

    NetBeans and Sun currently do not provide a forum here for NetBeans ( or other non-Sun IDEs.)
    As you note, NetBeans provides a mailing list as its way of support for the IDE. There is an associated forum, see the information about Nabble on this page from the NB site:
    http://www.netbeans.org/community/lists/
    Please post NB support and usage questions at the mailing list or Nabble, as this forum is for Java language topics. :

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

  • Saving all source files in a project to earlier version ?

    What is the quickest way to save all the source files in a project to an earlier version?
    I know that I can do it with individual files, but is there a way to do all at once?

    Sure, just do the same, as you save VIs for previous version. In the Project Explorer Window select File -> Save for Previous Version...

  • How to reference a folder/file outside from project folder

    Hi All,
    I have two extensions which wants to share some code(files) placed in a folder outside from source directory.
    for a simple case see the below example.
    created a sample extension HelloWorld whose project structure are as follows
    HelloWorld
         ExtensionContents
              lib/CSInterface-4.0.0.js
              jsx/InDesign.jsx
              HelloWorld.jsx
              index.html.
    I have another folder say "sharedAssets" it contains two images "Orange.gif and pear.gif" which is at same location where HelloWorld and now folder structure becomes
    HelloWorld > ExtensionContents
    sharedAssets > Orange.gif
                             pear.gif
    I have added linked resource folder see the attached screenshot
    I have written following line of codes in index.html
    <body onLoad="onLoaded()">
    <div id="content">
      <ul>
      <li><img src="Orange.gif" width="42" height="42"/></li>
      <li><img src="shared/pear.gif"/></li>
      </ul>
    </div></body>
    but when I opened the extension then it failed to load Orange.gif and pear.gif,
    Please let me know how I could reference an image placed in a folder outside from project folder.
    Regards,
    Alam

    Hi Alam,
    I don't use Eclipse / EB myself so I can be of no help in the way you set an alternate location folder there.
    I've looked in the MXI reference but it seems there's no token equivalent to the "parent folder of all extensions" i.e.
    /Users/Davide/Library/Application\ Support/Adobe/CEPServiceManager4/extensions
    or whatever it will be in the future. This is where Extension Manager puts stuff when the MXI is something like:
    <file   source="HTML/com.example.helloworld.zxp"
            destination=""
            file-type="CSXS"
            products="Photoshop,Photoshop32,Photoshop64"
            minVersion="14.0" />
    that is, destination is blank, file-type is "CSXS".
    I've never tried to put there stuff other than ZXP - you can give it a try.
    An alternative escamotage could be to use an external folder, which path token exists both in MXI land *and* in (CSInterface or ExtendScript).
    That is, a place Extension Manager installs your shared content; which path can be reached from the panel or the JSX.
    As an example $userdatafolder/alam/shared in MXI, and Folder.userData/alam/shared in JSX, or SystemPath.USER_DATA/alam/shared in JS.
    There are other product specific tokens (Photoshop Script folder for instance) where you can put things into.
    Regards
    Davide Barranca
    www.davidebarranca.com
    www.cs-extensions.com

  • Saving uploaded pdf files in an extenal folder

    Can anybody help me that what is the process of uploading files such as pdf or word files in some specified folder outside of database. I am using APEX 4 with oracle 11g.
    Kind Regards
    Mazahir Abbas

    Try This one...
    CREATE OR REPLACE PROCEDURE ORSC_RMS.sn_blob_to_server (p_filename IN VARCHAR2
    AS
    l_file UTL_FILE.file_type;
    l_buffer RAW (32767);
    l_amount BINARY_INTEGER := 32767;
    l_pos INTEGER := 1;
    l_blob BLOB;
    l_blob_len INTEGER;
    l_name VARCHAR2 (4000);
    BEGIN
    -- Open the destination file.
    l_file := UTL_FILE.fopen ('ORSC_DATAOUT', p_filename, 'w');
    -- Get LOB locator
    FOR rec IN (SELECT blob_content l_blob
    FROM apex_application_files
    WHERE ROWNUM = 1)
    LOOP
    l_blob_len := DBMS_LOB.getlength (rec.l_blob);
    -- Read chunks of the BLOB and write them to the file
    -- until complete.
    WHILE l_pos < l_blob_len
    LOOP
    DBMS_LOB.read (rec.l_blob, l_amount, l_pos, l_buffer);
    UTL_FILE.put_raw (l_file, l_buffer, FALSE);
    l_pos := l_pos + l_amount;
    END LOOP;
    COMMIT;
    END LOOP;
    -- Close the file.
    UTL_FILE.fclose (l_file);
    EXCEPTION
    WHEN OTHERS
    THEN
    -- Close the file if something goes wrong.
    IF UTL_FILE.is_open (l_file)
    THEN
    UTL_FILE.fclose (l_file);
    END IF;
    RAISE;
    END;
    /

  • Web assistant dump-file pre-seeded project folder structure

    We are using headstart which includes the headstart templates and libraries plus some customized libraries etc. as well.
    We haven't installed the web assistant yet I but have read that it has a dump-file that contains a pre-seeded project folder structure.
    Can someone give more details about this project folder structure? Does this structure support only the CDM and PJM deliverables?
    Thanks,
    [email protected]

    Bump.

  • Help Saving a .pdf file

    I've created a .pdf file ,but when i open the file,after i've created it ,it displays the left toolbar with the preview of all the pages of the entire file.
    The question is: How can i save the file in a way that it only displays for me the images without the "pages" en the other stuff on the left side of the page ?
    I'm using a pc with acrobat 9.2.
    On my pc i've managed to remove the toolbar,but when i try to open the same file on other computers it's back there again.
    I need this file to be sent for email,but my boss is really getting anoying about that toolbar !
    Help guys please !

    In Acrobat (not Reader), go to the document properties (control-D), choose the initial view tab and then select Page only. Then save. Please post future Acrobat questions to the Acrobat forum. Not the Reader forum.

  • Adobe Audition Help | Saving and exporting files (CS6)

    This question was posted in response to the following article: http://helpx.adobe.com/audition/using/saving-exporting-files1.html

    stvns wrote:
    Just to re-iterate the first three minutes of my audio has a marker called Marker 01, then the next 3 minute section is Marker 02, etc, so when I select all the markers, merge them, set the prefix and postfix to Track and 001 respectively, and click export, the audio that should accompany Marker 01, now as an exported wav file is Track_099 and Marker 99 is Track_001.
    Hmm... just one marker to start with? At the start or the end of the time selection? The only way that I think your scenario could happen would be by there being no marker at the very start of the file, but in that case I don't see how you could include the first section (from zero time) anyway if you did that, so I'm a bit dubious... What would happen in this scenario would be that if you put in markers starting at 1 from the end of the first section, it would have to add a final marker for the start of the file, and this would be, let's say, marker 99. So the first file would start with marker 99 - but that would effectively be at the end of the batch ranges - if you see what I mean. But my real problem with this is that I don't see how you could include the first range in the audio at all without a marker at both ends of it. Now, what might have happened is that if you forget, and add the start marker after putting in all of the rest, then yes, you will get the above scenario - because markers are added sequentially and renumbering doesn't occur.
    I've not had this problem - but there again I always start with a marker at zero before I convert to ranges. What should happen then is that it will take the marker label from the start of the range, and use that. The other thing you should consider is using the facility to rename the files - that should get around this completely as far as straightforward numbering is concerned.

  • I accidentally saved an excel file in the AutoRecovery Folder & can't find it....

    Other discussions have suggested the following route for discovery:
    Library>Application Support>Microsoft>Office>Office 2011 Auto Recovery
    But, I can only get as far as Microsoft and then cannot find Office etc.  The folders in my Microsoft folder are: PlayReady, Silverlight, MAU2.0 and MERP2.0 and none of them get me to Auto Recovery.
    Help!  I have been working on this for the past 4 days.

    I have done this as well -.- sooo stupid! I can see my file when I start a new document, then hit "save as" and select the "office 2011autorecovery" file. But it is kind of transparent (if that makes sense). I can't drag and drop nor right click.
    If I follow the route you describe I end up at the same dead end as you.
    However, when I go Documents>Microsoft User Data> it leads me to the file "Office 2011 Auto Recovery". This file however, is empty.
    I did try to uncover hidden files with a command in the terminal. This didn't help to find the lost file.
    How did you go? Could you find your excel? I am really desperate to find mine! Nothing that I can find on the internet seems to work.

  • How to read data from a .txt file in real time

    Hi
    I am running a fortran code which takes around 1 week to run and output data are continuously saved in .txt files. I want to display these data and plot it against time in labview.
    Lets say I have a array of real numbers starting from 1.0 , and every 2-3 sec another number is added (output of code). So I dont want end-of-file-reached error in my program and also want program to wait until next data is updated in .txt file.
    I tried to make a simple read_txt_file.vi, but I am getting problems in terms of continous reading. Help !! Help !!
    Pl see the attached vi.
    Thanx
    PKJ
    Attachments:
    FileReader.vi ‏43 KB
    labview.txt ‏18 KB

    Hi PKJ,
          I modified your VI and it seems to do what you asked, that is, display the data from a file as the data is being added.
    Hope it helps!
    Message Edited by Dynamik on 11-08-2005 04:32 PM
    Message Edited by Dynamik on 11-08-2005 04:34 PM
    When they give imbeciles handicap-parking, I won't have so far to walk!
    Attachments:
    FileReader.vi ‏52 KB

  • Invalid charater in Excel when input .txt file that run from Oracle discove

    Hi All,
    I ran a report from oracle discover and saved as txt file, then open it with excel, the chinese will be shown as invalid character.
    The problem is that Chinese characters can't be displayed well if I download the report (in csv ) from discover desktop version on my computer and open it with excel.
    Pls. help to resolve the problem.
    Thanks.

    Hello
    I'm afraid that I don't have much experience of working with Chinese characters and can see nothing in my notes that might help. Give it a couple of days for others to reply and if you don't get anywhere I recommend raising this as a service request with Oracle Support.
    Best wishes
    Michael

  • Beginner question - Can't read nor write a file using NetBean...

    Hi ,
    I'm a beginner java programmer, I got trouble when it comes to read or write a file program..
    I tried 3 programs and all of them can't read the file I want to read, eventhought I have put the txt file in the same folder with my source code.
    here is the source code I got from some site
    import java.io.*;
    class FileReadTest {
    public static void main (String[] args) {
         FileReadTest f = new FileReadTest();
    f.readMyFile();
    void readMyFile() {
    DataInputStream dis = null;
    String record = null;
    int recCount = 0;
    try {
    File f = new File("mydata.txt");
    FileInputStream fis = new FileInputStream(f);
    BufferedInputStream bis = new BufferedInputStream(fis);
    dis = new DataInputStream(bis);
    while ( (record=dis.readLine()) != null ) {
    recCount++;
    System.out.println(recCount + ": " + record);
    } catch (IOException e) {
    // catch io errors from FileInputStream or readLine()
    System.out.println("Uh oh, got an IOException error! " + e.getMessage());
    } finally {
    // if the file opened okay, make sure we close it
    if (dis != null) {
         try {
    dis.close();
         } catch (IOException ioe) {
    I also have tried another from book , both of them give the same result, can't read the file...
    Please help me with this...
    Thank you very much

    To start with use the full path to the file
    i.e. File f = new File("c:\\the\\full\\path\\to\\your\\file\\mydata.txt"); // Assumes a Windows platform using the C drive
    Then check to make sure you fiel exists e.g. System.out.println("File exists = " + f.exists());
    You can even test to see if the file is readable but since you created the file this porbably is not required.

  • Loading *.txt files in web service

    I have a running web service on Axis, and can communicate with it from a j2se client and a browser test client.
    I'm attempting to load a txt file of data in the web service (stores a list of usernames). But the code can't locate the text file. Where are external resource placed if they're needed in a web service? I was assuming I could just place it next to my *.java files.
    Thanks

    I should add that I'm using Eclipse , and as such my web service seems to be self contained in my workspace for Eclipse. The structure is
    EclipseWorkspace -> myProject -> projectNamespace -> *.java
    I thought I could place my *.txt files inside the namespace directory with my Java files. I have also tried placing the *.txt file in the project directory, still no luck.

  • Creating XML file in Project folder thru Java Program

    hi,
    i need one help. i need to create XML file in web://<Project Folder> in xmII thru Java Program. i created one java code and i am able to access XML file that is in c drive. i created jar file for this and placed as action block in Transaction and this working fine. but problem arises when i give file path in java code as web://<folder name>/file.xml which is in Web folder of project in xMII.
    How to access the file that is inside web folder from java code.
    regards
    senthil

    Hi Senthil,
    you can address the files that inside the MII workbench are viewed as "web://..." like this:
    http://<server>:<port>/XMII/CM/<Project>/<Folder>/<Filename>
    The workbench helps you find the correct filename:
    - open the WEB tab in the workbench
    - right-click on the filename
    - select "Copy Link" from the pop up
    Now you have the correct link in your clipboard.You can use the "web://" only inside MII.
    Michael

Maybe you are looking for

  • ORA-00316 in the alert log file

    Thu Aug 21 17:23:05 2008 Errors in file /ora_dump/CONCILIA/bdump/concilia_arc1_205172.trc: ORA-00316: log 3 of thread 1, type 0 in header is not log file ORA-00312: online log 3 thread 1: '/ora_data04/CONCILIA/redo01.log' Thu Aug 21 17:23:05 2008 Err

  • Method-permission in ejb-jar.xml

    Hi, Need understanding, whether <role-name> here is an "AND" or "OR" i.e to execute the method testmethod, the user has to be in both the roles or any one of the role. (Roles are mapped to groups in weblogic-ejb-jar.xml). <method-permission> <role-na

  • Firefox 4 wont load page completely or play videos on youtube after clearing cache

    Firefox 4 wont load page completely or play videos on youtube and ive noticed its always after clearing cache. after a while it will start working properly but its kind of annoying. Know what the problem is?

  • How do I dock Fireworks windows so they tile?

    Following the instructions in the Classroom in a Book for FW CS4, Lesson 1, I have tried numerous times to move one of the tabbed files to the right so it will dock next to the first window. It says to move the window to the right until a blue line c

  • MAC OS X Setup Resgistration again??

    I was getting a start up disk full message even when I had about 40GB available. But now when I turn on my laptop, I'm getting the MAC OS registration screen. Does this mean I lost all the document on HD. Please let me know if I should register. Than