JFileChooser chooser = new JFileChooser();
JDialog dialog=new JDialog();
dialog.setAlwaysOnTop(true);
/*System.out.println("is always on top?"+dialog.isAlwaysOnTop());*/
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
int returnVal = chooser.showOpenDialog(dialog);
String path = null;
if(returnVal == JFileChooser.APPROVE_OPTION) {
path=chooser.getSelectedFile().getAbsolutePath();
}
I have written this code in Servlet's doGet
method.when i deployed in linux server getting following exception:
java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:159)
Does anyone know how to over come this?