Results 1 to 2 of 2
  1. #1
    amr magdy is offline Member
    Join Date
    Dec 2011
    Rep Power

    Question 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 ???

  2. #2
    j2me64's Avatar
    j2me64 is offline Senior Member
    Join Date
    Sep 2009
    Zurich, Switzerland
    Rep Power

    Default 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.

Similar Threads

  1. I need to set new directory path in tomcat
    By Mayank Joshi in forum Java Servlet
    Replies: 2
    Last Post: 05-05-2010, 12:16 PM
  2. Replies: 2
    Last Post: 05-11-2009, 10:07 AM
  3. Select File
    By Doctor Cactus in forum New To Java
    Replies: 2
    Last Post: 11-06-2008, 05:38 AM
  4. how to use JFileChooser to select file -> string
    By gezzel in forum AWT / Swing
    Replies: 15
    Last Post: 10-23-2008, 05:34 AM
  5. [SOLVED] File chooser selecting file from directory...?
    By prabhurangan in forum AWT / Swing
    Replies: 12
    Last Post: 06-18-2008, 04:08 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts