【问题标题】:How to Correctly use com.mattbertolini.hermes.Hermes to manage Constants at Server side (GWT)?如何正确使用 com.mattbertolini.hermes.Hermes 在服务器端(GWT)管理常量?
【发布时间】:2014-03-07 16:46:53
【问题描述】:

好的,我想在服务器级别管理常量,所以com.mattbertolini.hermes.Hermes 是一个解决方案。

请查看我的所有步骤:

1-我下载了hermes-1.2.0.jar并导入到正确的eclipse库中(没问题)

2- 在客户端包中创建MyConstantsWithLookup.java

import com.google.gwt.i18n.client.ConstantsWithLookup;

public interface MyConstantsWithLookup extends ConstantsWithLookup {
    String myMsg();
}

3- 在同一个客户端包中创建MyConstantsWithLookup.properties 文件。该文件有这一行:

myMsg=Deleted

4- 在 Server 包的 ServerData.java 中

MyConstantsWithLookup my = Hermes.get(MyConstantsWithLookup.class, "");
String  extra=my.myMsg();

在 Eclipse 中测试时它工作正常,但我在 Eclipse 中收到警告消息:

[警告] 在 Web 应用程序中找不到服务器类“com.ibm.icu.util.ULocale”,但在系统类路径中找到 [警告] 添加类路径条目'file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt -2.5.0/gwt-dev.jar' 到此会话的 Web 应用程序类路径 有关其他信息,请参阅:file:/C:/Users/eclipse-jee-juno-SR1-win32-x86_64/eclipse/plugins/com.google.gwt.eclipse.sdkbundle_2.5.0.v201212122042-rel-r42/gwt-2.5 .0/doc/helpInfo/webAppClassPath.html

我不确定这个警告是关于什么的?严重吗?

代码运行正常,但为什么 eclipse 会产生这个警告?

【问题讨论】:

    标签: gwt gwtp


    【解决方案1】:

    这个类(com.ibm.icu.util.ULocale)是java.util.Locale的替代品,所以看来Hermes对它有依赖。

    http://site.icu-project.org/download 下载 ICU4J jar 并将其添加到项目的构建路径中。

    来源: Matt Bertolinihttps://github.com/mattbertolini/Hermes/issues/3

    您需要添加位于http://site.icu-project.org/ 的 ICU4j jar 到你的类路径。你在里面有ICU班的原因 gwt-dev.jar 是因为 GWT 将它们包含在其 Java 到 JavaScript 中 编译器。这是令人遗憾的,因为它经常错误地报告 类路径中的文件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-02-10
      • 1970-01-01
      • 2013-09-21
      • 2015-01-17
      • 1970-01-01
      • 1970-01-01
      • 2021-12-19
      相关资源
      最近更新 更多