FileDialog's setFilterPath() method allows you to specify the initial directory for the dialog.
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Shell;
public class FileDialogStartingDirectoryFileName {
public static void main(String[] args) {
Display display = new Display();
final Shell shell = new Shell(display);
FileDialog dlg = new FileDialog(shell, SWT.OPEN);
dlg.setFilterPath("C:/");
String fileName = dlg.open();
if (fileName != null) {
System.out.println(fileName);
}
display.dispose();
}
}