简体   繁体   中英

How to use classes from other packages in SmartGWT

If I try use method from another package, I'm getting an error:

[ERROR] [odminterface] - Errors in 'file:/C:/Eclipse%20EE%20WS/ODMInterface/src/com/odminterface/client/ODMInterface.java'

[ERROR] [odminterface] - Line 71: No source code is available for type com.testpack.test.PackTest; did you forget to inherit a required module?

[ERROR] [odminterface] - Unable to find type 'com.odminterface.client.ODMInterface'

[ERROR] [odminterface] - Failed to load module 'odminterface' from user agent 'Mozilla/5.0 (Windows NT 6.1; rv:10.0.2) Gecko/20100101 Firefox/10.0.2' at 127.0.0.1:6575

My project: http://s019.radikal.ru/i616/1207/2e/1e224907c5c1t.jpg

ODMInterface.gwt.xml code:

<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='odminterface'>

<inherits name='com.google.gwt.user.User'/>
<inherits name='com.smartgwt.SmartGwt'/>

<inherits name='com.google.gwt.user.theme.clean.Clean'/>

<entry-point class='com.odminterface.client.ODMInterface'/>

<source path='client'/>
<source path='shared'/>
</module>

PackTest code:

package com.testpack.test;


public class PackTest 
{

public void test()
{

}
}

If I put "PackTest" class to "com.odminterface.client" pakage - all work fine.

How to call a class method that is in another package?

By default GWT looks for java sources in client package relative to the package of module (eg module is in ODMInterface.gwt.xml is in package com.odminterface so java sources will be expected to be in 'com.odminterface.client').

Additional packages can be added using source tag (see your ODMInterface.gwt.xml for example usage, there are already two packages added using source tag).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM