Since File class cannot be used to change the current working directory, can anyone tell me which class can be used to change the current working directory to specified directory. Thanks in advance!
Peter Tran
Bartender
Joined: Jan 02, 2001
Posts: 783
posted
0
You use the File class and the list() method along with isDirectory or isFile to find what you want. If it's a directory, then you create another File object to move to the new directory. Not very elegant, but that's the only way. -Peter
Charlie Swanson
Ranch Hand
Joined: Jan 29, 2001
Posts: 213
posted
0
Hello, I am a greenhorn, but I believe you cannot in one command change a default directory. There may be other options depending on what you want to do. For example: I Create another directory with a copy of the file you want. 1. Copy the existing file 2. Save a copy of the file in the area that you want to save it. If no directory already exists that create one with the mkdir command. II. Refer to the file that you want to use with the file path name and the string name. public File(String directoryPath, String filename)
III. Refer to the directory where the file is wanted: public File(String directory Path) I hope this helps, if you need more info let me know.
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.