How to Correctly use com.mattbertolini.hermes.Hermes to manage Constants at Server side (GWT)?

StackOverflow https://stackoverflow.com/questions/22255857

  •  11-06-2023
  •  | 
  •  

Question

Ok, I want to manage Constants at Server level, so com.mattbertolini.hermes.Hermes is a solution.

Please see all my steps:

1- I downloaded hermes-1.2.0.jar & import into correct Library of eclipse (no problem)

2- Create MyConstantsWithLookup.java at client package

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

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

3- create MyConstantsWithLookup.properties file in the same client package. The file has this line:

myMsg=Deleted

4- In ServerData.java in Server package

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

When tested in eclipse it works fine but I got Warnign message in eclipse:

[WARN] Server class 'com.ibm.icu.util.ULocale' could not be found in the web app, but was found on the system classpath
   [WARN] Adding classpath entry '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' to the web app classpath for this session
   For additional info see: 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

I am not sure what this warning's about? is it serious?

The code was running ok but why eclipse generated this warning?

Was it helpful?

Solution

This class (com.ibm.icu.util.ULocale) is a replacement for java.util.Locale, so it seems Hermes has a dependency on it.

Download the ICU4J jar from http://site.icu-project.org/download and add it to your project's build path.

Source: Matt Bertolini at https://github.com/mattbertolini/Hermes/issues/3

You need to add the ICU4j jar located at http://site.icu-project.org/ to your classpath. The reason you have the ICU classes inside the gwt-dev.jar is because GWT includes them for its Java to JavaScript compiler. This is regrettable since it often times falsely reports the files on your classpath.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top