SWT Java Tutorial

import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class DirectoryDialogGetSelectedDirectory {
  public static void main(String[] args) {
    Display display = new Display();
    final Shell shell = new Shell(display);
    DirectoryDialog dlg = new DirectoryDialog(shell);
    String selectedDirectory = dlg.open();
    System.out.println(selectedDirectory);
    
    display.dispose();
  }
}