My code is working fine (choosing directory) when used in the main method. However, using the same code copied into a servlet, isn't working, what should I do to get this to work with servlet?
public class SelectDirectory {
public static void main(String args[]) throws IOException, Exception {
JFileChooser chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle("choosertitle");
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
chooser.setAcceptAllFileFilterUsed(false);
if (chooser.showOpenDialog(null) == JFileChooser.APPROVE_OPTION) {
String dirFolder = "" + chooser.getSelectedFile() + "";
FunctionsOfZip zipFun = new FunctionsOfZip();
zipFun.InputReader(dirFolder);
} else {
System.out.println("No Selection ");
}
}
}