Results 1 to 2 of 2
- 12-29-2011, 12:09 PM #1Member
- Join Date
- Dec 2011
- Rep Power
how can i get directory path without select any file ?
how can i get directory path without select any files just select directory by user ?
i tried to use "jfilechooser " but user must choose someone file to get its directory path but i want to make the user select just " directory " to save his file in it ???
- 12-29-2011, 12:52 PM #2
Re: how can i get directory path without select any file ?
You could set the path of the class containing the main() method with
File startingDir = new File(ClassWithMain.class.getProtectionDomain().get CodeSource().getLocation().getPath());
Instead of ClassWithMain you can use an other class in your project root or a reachable class in the classpath.
- By Mayank Joshi in forum Java ServletReplies: 2Last Post: 05-05-2010, 01:16 PM
- By svpriyan in forum New To JavaReplies: 2Last Post: 05-11-2009, 11:07 AM
- By Doctor Cactus in forum New To JavaReplies: 2Last Post: 11-06-2008, 06:38 AM
- By gezzel in forum AWT / SwingReplies: 15Last Post: 10-23-2008, 06:34 AM
- By prabhurangan in forum AWT / SwingReplies: 12Last Post: 06-18-2008, 05:08 AM