Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2005

Tip: Looking for answers? Try searching our database.

java.io and user.dir

Thread view: 
Benji - 01 Nov 2005 03:56 GMT
The comments in the File javadoc state the following:

By default the classes in the java.io package always resolve relative
pathnames against the current user directory. This directory is named
by the system property user.dir, and is typically the directory in which
the Java virtual machine was invoked.

Now, I've seen several old threads on various forums asking why user.dir
is read-only, and I believe there was a feature request put in for allowing
user.dir to be modifiable.  So, I checked to see if I could set it, and
it turns out I can.  And, in fact, if I create a new File like
new File("tmp.txt"), the absolute path name gets changed based on what I
set user.dir to.

However, it seems that at least the native method "open" in FileInputStream
does not use the system property "user.dir".  So, my question is, is this
an impossible task?  Or is there something else I need to do besides
System.setProperty("user.dir");

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.

Benji - 01 Nov 2005 04:25 GMT
> <snip>

Well, I'm going to answer my own question and say "don't do it".

apparently as of fairly recently, they've resolved to not fix this at
any point in the near future.  (although, I think that making a setProperty
call on "user.dir" fail in some way would be most helpful.  =P)

Signature

Of making better designs there is no end,
 and much refactoring wearies the body.



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.