• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Liutauras Vilda
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Jj Roberts
  • Stephan van Hulst
Bartenders:
  • Himai Minh
  • Carey Brown
  • Frits Walraven

Alternative to user.dir?

 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there any other way to determine which hard drive that the user launched a java application from besides user.dir?
user.dir seems to be broken in the runtime I'm using.
Thanks,
Drew
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well user.dir is the one that's supposed to be guaranteed, so I'm wondering why it doesn't work. How are you calling it? What result do you get? As an alternative though, you can try something like
new File("").getAbsolutePath()
new File(".").getAbsolutePath()
new File("").getCanonicalPath()
new File(".").getCanonicalPath()
Interpretation of these paths ("" or ".") is OS-dependant, but I believe they should work to give you the current working directory on most Windows and Unix systems (no idea about Mac). Hope that helps...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic