在GWT中使用Java.util.scanner [英] Using Java.util.scanner with GWT
问题描述
出于某种原因,当我尝试使用带gwt的扫描器时,出现以下错误:
没有源代码可用用于java.util.Scanner类型;你忘了继承一个必需的模块吗?
我环顾四周,看起来没有源代码可用于xxxx类型错误是由于没有Java类型的Javascript等效类型。
扫描器无法与GWT一起使用吗?
以下是我的代码片段:
import java.util.Scanner;
...
public void submit(){
String text = editor.getEditor()。getText();
扫描仪输入=新扫描仪(文本);
while(input.hasNextLine()){
String line = input.nextLine();
if(line.contains(//)){
cInfo.setDone(false);
cInfo.setCode(text);
return;
}
cInfo.setDone(true);
cInfo.setCode(text);
$ b
java.util.Scanner不是GWT JRE仿真的一部分。如果您需要关于仿真内容的详细信息,请点击这里链接到文档:
https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation#Package_java_util
for some reason when I try to use scanner with gwt, i get the following error:
No source code is available for type java.util.Scanner; did you forget to inherit a required module?
I looked around and it seems the "No source code is available for type xxxx" errors are due to not having a Javascript equivalent type for the Java type. Is scanner not able to be used with GWT?
Here is a snippet of my code:
import java.util.Scanner;
...
public void submit(){
String text = editor.getEditor().getText();
Scanner input = new Scanner(text);
while(input.hasNextLine()){
String line = input.nextLine();
if(line.contains("//")){
cInfo.setDone(false);
cInfo.setCode(text);
return;
}
cInfo.setDone(true);
cInfo.setCode(text);
}
}
}
java.util.Scanner is not part of the GWT JRE Emulation. If you need a detail overview of what is inside the emulation here is the link to the docs:
https://developers.google.com/web-toolkit/doc/latest/RefJreEmulation#Package_java_util
这篇关于在GWT中使用Java.util.scanner的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!