Here you can find the source of showDirSelect()
public static String showDirSelect()
//package com.java2s; //License from project: Apache License import javax.swing.JFileChooser; import javax.swing.UIManager; public class Main { public static String showDirSelect() { try {/* w ww . j a va 2 s .co m*/ UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (Exception e) { } JFileChooser chooser = new JFileChooser(); chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); int returnVal = chooser.showOpenDialog(null); if (returnVal == JFileChooser.APPROVE_OPTION) { String path = chooser.getSelectedFile().getAbsolutePath(); return path; } return null; } }