File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Writing to jump drives instead of System System.getProperty( Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Writing to jump drives instead of System System.getProperty("user.home", ".")" Watch "Writing to jump drives instead of System System.getProperty("user.home", ".")" New topic
Author

Writing to jump drives instead of System System.getProperty("user.home", ".")

Steve Howerton
Ranch Hand

Joined: Oct 18, 2011
Posts: 41
Hello.
I have an app that is set up to build a dir tree based on user and profile when
they log in.

Right now it is running in the NETBEANS IDE. It will use properties to
derive the hard drive to mkdir's. I plan on creating a app.jar and
put it on a jump drive. I would like to execute the program from the jump drive
by double clicking it. Instead of creating dir on the hard drive I would like
to create them on the jump drive when the jump drive is plugged in and the
app is executed.
My question is : How can I design the class to derive what drive it is and how
to make it the USER_HOME so I can mkdir on the jump drive? Is there a way to do this?

Right now I do this using public static final String USERHOMEDIR = System.getProperty("user.home", ".")
Thanks.

Steve Howerton
Ranch Hand

Joined: Oct 18, 2011
Posts: 41
My programs objective is to mkdir and ope dir.

if I ever get it jarred up I would like to run it from a jump drive.



clearly this code will not be valid any more.
Could this USERHOMEDIR be replaced correctly each time the jump drive is moved from one client to the
next?

again the main objective of the program would be to create dir's and place doc in a a file system on the
jump drive and maintain access to those dir no matter where I use the jump drive.

are there other unforseen technical hurdles to jump over?
thanks;
5:10 AM 2/25/2013
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2173
    
  47
I don't really understand what you are trying to achieve but if you want to know the directory the app is running from use the system property "user.dir"
Steve Howerton
Ranch Hand

Joined: Oct 18, 2011
Posts: 41
That will do for now. I am just collecting some code that will allow my app to mkdir on a jump drive where it will hopefully run from as soon as I figure out how to jar it up. thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Writing to jump drives instead of System System.getProperty("user.home", ".")
 
Similar Threads
Calling a java object fromn a store procedure no idea how to get it to work
Environment Variable!!
images in JList
Ant control
NPE