*
The moose likes Beginning Java and the fly likes specifiy a file local in code Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "specifiy a file local in code" Watch "specifiy a file local in code" New topic
Author

specifiy a file local in code

jite eghagha
Ranch Hand

Joined: Oct 06, 2006
Posts: 127
If i had this file structure:

Plants
cat.class
David McCombs
Ranch Hand

Joined: Oct 17, 2006
Posts: 212
I am not sure what you mean.

Do you mean Plants is a file in the same folder as cat.class, and cat needs to open Plants? Or something else?

If it is the former, you don't need include a file path in the IO class you are using to open it. ie FileReader fr = new FileReader("Plants");

If it is the latter, please post a bit more detail.


"Should array indices start at 0 or 1? My compromise of 0.5 was rejected without, I thought, proper consideration."- Stan Kelly-Bootle
jite eghagha
Ranch Hand

Joined: Oct 06, 2006
Posts: 127
sorry about that,

animals>
cat.class
dog.class
data.txt

what string points to the bat.txt; i think it looks something like this. (because they're in the same folder)

wolf.getTextFile("..//bat.txt");
[ June 15, 2007: Message edited by: jite eghagha ]
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14111
    
  16

It's not very clear what you are asking. Can you please explain in more detail what you want to know exactly?

Why not just do this:

wolf.getTextFile("bat.txt");


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: specifiy a file local in code