Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

javaBeans

macrumors newbie
Original poster
Jan 19, 2006
3
0
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?
 

bousozoku

Moderator emeritus
Jun 25, 2002
16,120
2,397
Lard
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.
 

javaBeans

macrumors newbie
Original poster
Jan 19, 2006
3
0
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...
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
javaBeans said:
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...

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

jeremy.king

macrumors 603
Jul 23, 2002
5,479
1
Holly Springs, 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...
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.