GWT. commons.lang.StringUtils

1,923 views
Skip to first unread message

Arar

unread,
Jul 22, 2010, 7:23:43 PM7/22/10
to Google Web Toolkit
Hi,

I am trying to search between two Strings using the
StringUtils.substringBetween() in my project. I have imported
org.apache.commons.lang.StringUtils; in my Entry Point java file . I
have included common-lang.jar in my lib directory and in my project
path. I have also modifed my gwt.xml
<inherits name="com.googlecode.gwt.commons.long.Long/>. I dont know
if this is right or wrong.

The Java Compilation goes through without any Errors . but if i do a
GWT compile i get the following error

[ERROR] Line 190: No source code is available for type
org.apache.commons.lang.StringUtils; did you forget to inherit a
required module?
lib/gwtx-1.5.2.jar!/com/googlecode/gwtx/java/util/emul/java/util/regex/
Pattern.java'
[WARN] Line 140: Referencing class
'com.googlecode.gwtx.java.util.emul.java.util.regex.Pattern': unable
to resolve class, expect subsequent failures
[WARN] Line 149: Referencing class
'com.googlecode.gwtx.java.util.emul.java.util.regex.Pattern': unable
to resolve class, expect subsequent failures
[WARN] Line 183: Referencing class
'com.googlecode.gwtx.java.util.emul.java.util.regex.Pattern': unable
to resolve class, expect subsequent failures


I want to know if its possible to includes
"org.apache.commons.lang.StringUtils" in GWT and how can i do the
inherits in my GWT.XML file or i am digging in the wrong way.

Please HELP.
Any help would be appreciated. Thank you very much.

Feldman, Nir (48Upper)

unread,
Jul 25, 2010, 4:46:28 PM7/25/10
to google-we...@googlegroups.com
It is not really possible since StringUtils is based on java regular expression and the GWT regular expression emulator is based on a javascript. You will need to write it by your own

Hi,

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To post to this group, send email to google-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

Blagoja Chavkoski

unread,
Jul 25, 2010, 5:11:06 PM7/25/10
to google-we...@googlegroups.com
Hi,

You cant use any java.jar file in gwt without having the source code included in the jar and having
the gwt.xml file pointing to the source classes...why u need this?! because gwt compiler needs to compile this classes
to js! gwt by default compiles all classes in client and all classes in shared to js, and bacause u have a import for commons gwt try's to compile
this import also!!! but there is no source code and no gwt.xml file in the jar

If you dont understand what im saying:) open one of the "normal" .jar lib files used in gwt and youll see that inside u have all I wrote before! (source classes and gwt.xml)

Important!!

If having a lib that inside uses other lib..than u need the same thing for this imported lib:)...so basic dont use in client and shared any java lib other then the
normal java lang libs(the compiler have the source for them by default)...to see what im talking...try to add insted of ArrayList... ConcurentArrayList...ull get the same problem..because the compiler dosent recognize this libs also:))

regards blaze,
Hope i was of help...

Thomas

unread,
Mar 19, 2012, 3:00:10 AM3/19/12
to Google-We...@googlegroups.com
Blagoja Chavkoski <baze985@...> writes:

>
>
> Hi,You cant use any java.jar file in gwt without having the source code

included in the jar and having the gwt.xml file pointing to the source
classes...why u need this?! because gwt compiler needs to compile this classes
> to js! gwt by default compiles all classes in client and all classes in shared
to js, and bacause u have a import for commons gwt try's to compile this import

also!!! but there is no source code and no gwt.xml file in the jarIf you dont

understand what im saying:) open one of the "normal" .jar lib files used in gwt
and youll see that inside u have all I wrote before! (source classes and

gwt.xml)Important!!If having a lib that inside uses other lib..than u need the

same thing for this imported lib:)...so basic dont use in client and shared any
java lib other then the
> normal java lang libs(the compiler have the source for them by default)...to
see what im talking...try to add insted of ArrayList... ConcurentArrayList...ull
get the same problem..because the compiler dosent recognize this libs

also:))regards blaze,Hope i was of help...
> On Sun, Jul 25, 2010 at 10:46 PM, Feldman, Nir (48Upper) <nir.feldman-
VXdht...@public.gmane.org> wrote:It is not really possible since StringUtils

> To post to this group, send email to google-web-toolkit-
/JYPxA39Uh5...@public.gmane.org.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe
<at> googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/google-
web-toolkit?hl=en.

> --
> You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.

> To post to this group, send email to google-web-toolkit-
/JYPxA39Uh5...@public.gmane.org.
> To unsubscribe from this group, send email to google-web-toolkit+unsubscribe
<at> googlegroups.com.


> For more options, visit this group at http://groups.google.com/group/google-
web-toolkit?hl=en.
>
>
>
>


Hi Blagoja,

What if the class is in 'server'?

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-
plugin:2.3.2:compile (default-compile) on project xyz: Compilation failure:
Compilation failure:
[ERROR] \eclipse-3.7\workspace\xyz\src\com\x\y\z\server\UserServiceImpl.java:
[20,30] package org.apache.commons.lang does not exist
[ERROR] \eclipse-3.7\workspace\xyz\src\com\x\y\z\server\UserServiceImpl.java:
[248,75] cannot find symbol
[ERROR] symbol : variable StringUtils
[ERROR] location: class com.rbs.samuraiweb.server.UserServiceImpl
[ERROR] -> [Help 1]

It works if I add lang3 dependency in the pom file and use lang3 instead of
lang, but that's not what I want to do...
Any way to get org.apache.commons.lang.StringUtils working?

Regards,

Thomas

Reply all
Reply to author
Forward
0 new messages