• Post Reply Bookmark Topic Watch Topic
  • New Topic

File System Help  RSS feed

Chris Shepherd
Ranch Hand
Posts: 286
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Could someone point me to or give me a good explanation/example of dealing with the location of files within the filesystem. I need to be able to do this on different OS's, but without having to explicitly do the same action 2 different ways and use an if statement to choose every time. I have looked at the java docs on File but it didn't get me very far. I also looked at the Java Tutorial, but it didn't help much either
I need to be able to:

  • findout what the working directory is
  • change the working directory to the location of my program if need be. Once there, I could probably solve the next issue.
  • store a set of resource directories between program sessions. I suppose this could be done with a text file, but I have to know the path to that file so I can open it.
  • avoid hardcoding paths into my code.

  • These are the things I am having a hard time figuring out. Any help with some or all of them would be appreciated.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!