Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Files & file systems  RSS feed

 
hennie louw
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all , I'm writing a tool that takes to vectors and writes the contents of them to two files, this is a small loging tool i'm writing, the problem I'm having is this.
As far as I can undrestand , File paths in java are not system independant, witch seems logical to me , having exsperiance in linux and win32 systems.
and according to jdk1.4 doc's there relitive paths are also not independat.
So what I want to do is give someone using this tool of mine the option to check what kind of system is running and the set the relitve path accordingly for that system, does anybody know how this can be done, plus the tool is still in alpha version, but i would like to release the source , if someone is intrested in helping me code this please let me know so i can set up some sort of cvs system for this smaal part time project , Regrads
 
Steve Deadsea
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are several ways to get system independent file handling.
First, there are two directories that you can use easily. The user's home directory which is in a System property, and the other is the current working directory which you is the default if you create a File object.
From there, you can use File.parentFile() to get the parent directory and you can create new directories in that directory.
 
hennie louw
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi thanks , i got it to work , but now i have a differnt prob, lets say you have an object called A and inside a you instanciate B ,and inside B you instaniate C , is there a way you can call a method coded in A in C ?
sort of like
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!