GWT - 您是否忘记继承所需的模块? [英] GWT - did you forget to inherit a required module?

查看:21
本文介绍了GWT - 您是否忘记继承所需的模块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的 GWT 应用程序中,在客户端 Java 文件中,我写了一行来打印语言环境:

In my GWT application, on the client side Java file, I have written a line to print the Locale:

System.out.println(Locale.getDefault());

这里的 Locale 是 java.util.Locale 的一个实例.

Here Locale is an instance of java.util.Locale.

我收到一个异常:09:31:53.656 [ERROR] [stockwatcher] Line 167 No source code is available for type java.util.Locale;你忘记继承一个必需的模块了吗?

令人惊讶的是,在这个类中我还使用了 java.util.ArrayListjava.util.Date 但我没有得到这些类的任何异常.

Surprisingly, in this class I've also used java.util.ArrayList and java.util.Date but I did not get any exception for those classes.

我在这里做错了什么?

推荐答案

GWT 的客户端无法访问整个 Java API.Java.util.Locale 就是其中之一.您不能在客户端使用甚至导入它.但是您绝对可以在 GWT 的服务器端使用它.您可以在此处.

The client-side of GWT does not have access to the whole Java API. Java.util.Locale is one of them. You can't use or even import it on the client-side. But you can definitely use it on the server-side of GWT. You can find the list of classes that can be used at client-side here.

这篇关于GWT - 您是否忘记继承所需的模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆