Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > filereader, java, and mac os x file paths

filereader, java, and mac os x file paths
Thread Tools
Mac Elite
Join Date: Sep 2001
Location: MA, USA
Status: Offline
Reply With Quote
Mar 28, 2004, 04:41 PM
 
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
Reply With Quote
Mar 28, 2004, 05:04 PM
 
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
Reply With Quote
Mar 28, 2004, 05:34 PM
 
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
Reply With Quote
Mar 28, 2004, 06:02 PM
 
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.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:05 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2