file access question

Discussion in 'Mac Programming' started by javaBeans, Jan 19, 2006.

  1. javaBeans macrumors newbie

    Jan 19, 2006
    hi all, im new to the mac platform, new to mac programming and new to xcode.

    For a assignment in school i need to do some basic file access operations in java. the problem is how do i do that in xcode? i have a input file in the same directory as the .java file but everytime i try to run it give me a IOException error. o btw the input file is a .rtf file could that be the problem? what do i need to do in order to read this file in my program?
  2. bousozoku Moderator emeritus

    Jun 25, 2002
    Gone but not forgotten.
    You'll have to learn how to read the format. It's not easy to do, but you might find a Java library if you search on Rich Text Format.

    You might start with learning to read a plain text file to refine your techniques and work up to reading more sophisticated file formats.
  3. javaBeans thread starter macrumors newbie

    Jan 19, 2006
    well, actually even when i try to read in a txt file it still gives me a IOException and exits with "status 1"??? what is that supposed to mean...
    there shouldn't be ne problems with the code cuz i've done it many times before on the PC. does anybody know whats going on? im sure i put the file in the right location, its in the same directory as the java file...
  4. robbieduncan Moderator emeritus


    Jul 24, 2002
    What path are you giving to the file? If possible give it an absolute path. If you are just saying "file.txt" it will probably not work as that won't be in your current path. Use something like "/Users/javaBeans/files/files.txt".
  5. jeremy.king macrumors 603


    Jul 23, 2002
    Fuquay Varina, NC
    When you ask for help, posting code (applicable snippets are fine) AND associated stack traces can really help us help you...Also, when you do this, learn to use the code tags...
  6. javaBeans thread starter macrumors newbie

    Jan 19, 2006
    ok thx for all the replies, i got it figured out now!

Share This Page