 |
 |
filereader, java, and mac os x file paths
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2001
Location: MA, USA
Status:
Offline
|
|
I have to read a dat file that has a random numbers of integers and find the average. At school, I made the file that created the dat file but I wanted to work on it at home. The problem is, my high school uses windows machine and I can't seem to figure out the path format for mac os x. I have the dat file in my user folder so i tried ""~\\RanDat.dat" but it said it could not be found. What is the file path of a file in my user folder?
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2001
Location: MA, USA
Status:
Offline
|
|
And as if it couldn't be more annoying, I had it create a file:
BufferedWriter outStream = new BufferedWriter(new FileWriter("Java1705.dat"));
String outString = "Testing, Testing 1 2 3";
outStream.write(outString);
outStream.close();
System.out.println("Java1705.dat is created\n");
Xcode gives me:
Java1705.dat is created
Filer3 has exited with status 0.
And guess what? When i type in Java1705.dat in the find window, mac os x can't find the file so can't even try to figure this out by myself because i can't even test the filepaths.
|
|
|
| |
|
|
|
 |
|
 |
|
Clinically Insane
Join Date: Oct 2001
Location: San Diego, CA, USA
Status:
Offline
|
|
The file path of a file in your home folder is /Users/YourUserName/MyFile. You can dynamically get the path to the current user's home directory through the System class.
No idea why you couldn't find the file. Are you sure it's set to search everywhere (and not, for example, just in your home folder)?
|
|
Chuck
___
"Instead of either 'multi-talented' or 'multitalented' use 'bisexual'."
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Sep 2001
Location: MA, USA
Status:
Offline
|
|
Originally posted by Chuckit:
The file path of a file in your home folder is /Users/YourUserName/MyFile. You can dynamically get the path to the current user's home directory through the System class.
No idea why you couldn't find the file. Are you sure it's set to search everywhere (and not, for example, just in your home folder)?
I finally figured it out, it was stored within the app package itself, which is why i couldn't find it. I had to place the randat file with the jar file, and just put FileReader("RanDat.dat") and it found the file.
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|