I tried the following code,
File folder = new File("/path/of/the/directory");
File[] listOfFiles = folder.listFiles();
for (int i = 0; i < listOfFiles.length; i++) {
if (listOfFiles[i].isFile()) {
if ((listOfFiles[i].getName()).contains(".xml")) {
Window.alert("File " + listOfFiles[i].getName());
}
}
}
But, I got this error:
No source code is available for type java.io.File; did you forget to inherit a required module ?
Can anyone help me to do the same using GWT?
Thanks in advance,
Gnik
Short answer
You cannot use the
Java.io.Fileclass in GWT.Except if you use gwt-filesystem
“Large” answer
From groups :
You should go to the Google Documentation about the JRE Emulation Reference.
According to the documentation :
However, you can use the gwt-filesystem project :