Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Reading Files in Java

Name: Anonymous 2010-11-27 12:30

Whenever I read a file in java I always have to put the text file in some arbitrary folder. How can I make my program read/writes files from the same folder that its in.

I want this to work so that even if its moved to another folder or computer, it still works.

Name: Anonymous 2010-11-27 14:10

Oh yeah, the direction of the (forward/back) slash is OS dependent.  Use java.io.separatorChar to be certain that you're using the correct one; asides from that Java may also want you to escape the appropriate slash (e.g., "\\") when you write the file path in a String object.
It gets real finicky about escape characters.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List