mardi 10 mars 2015

What module do I need to inherit for java.io and java.nio for my GWT project?



I am trying to follow this example:



Charset utf8 = StandardCharsets.UTF_8;
List<String> lines = Arrays.asList("1st line", "2nd line");
try {
Files.write(Paths.get("file5-test.txt"), lines, utf8);
} catch (IOException e) {
e.printStackTrace();
}


I have imported the required modules:



import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;


However I get the following error when I compile:



[ERROR] Errors in 'file:/C:/Users/Glyndwr/workspace/AwardTracker_N/src/org/AwardTracker/client/PackSummaryView.java'
[ERROR] Line 309: No source code is available for type java.nio.charset.Charset; did you forget to inherit a required module?
[ERROR] Line 309: No source code is available for type java.nio.charset.StandardCharsets; did you forget to inherit a required module?
[ERROR] Line 313: No source code is available for type java.nio.file.Files; did you forget to inherit a required module?
[ERROR] Line 313: No source code is available for type java.nio.file.Paths; did you forget to inherit a required module?


I think I need to add to my AwardTracker.gwt.xml:



<inherits name="module name/>"


However, I can not find the correct module name to inherit.

Also, is there a jar I need to import?


Your help would be greatly appreciated.


Regards, Glyn




Aucun commentaire:

Enregistrer un commentaire