我想尝试这个例子:
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();
}
我已导入所需的模块:
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
但是编译时出现以下错误:
[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?
我想我需要添加到我的AwardTracker.gwt.xml:
<inherits name="module name/>"
但是,我找不到要继承的正确模块名称 还有,我需要导入一个罐子吗?
非常感谢您的帮助。
问候,Glyn
答案 0 :(得分:1)
这看起来像服务器端代码,不应该是GWT客户端的一部分。