import java.text cannot be resolved to a type

2,385 views
Skip to first unread message

adrian carr

unread,
Oct 3, 2006, 5:12:40 PM10/3/06
to Google Web Toolkit
Anyone ever see this message in the development shell?
"import java.text cannot be resolved to a type"

It barfs on this line (right after my gwt import statements):
import java.text.SimpleDateFormat;

Any help is appreciated. It compiles fine in Eclipse, no errors until I
try to run.

Thanks,
Adrian

Jason Essington

unread,
Oct 3, 2006, 5:37:10 PM10/3/06
to Google-We...@googlegroups.com
GWT converts java code to javascript, but it only understands a small
subset of java. If you use something that GWT doesn't understand, you
will see a message like the one you are seeing.

In your client code, you can only use java classes that gwt supports:
http://code.google.com/webtoolkit/documentation/jre.html
nothing from java.text is supported

To perform date formatting you would have to use a different method.
There is a class that performs some very simplistic date formatting
(org.gwtwidgets.client.util.SimpleDateFormat) in Rob Hanson's gwt-
widget library
http://gwt-widget.sourceforge.net/

-jason

Owen

unread,
Oct 3, 2006, 9:12:59 PM10/3/06
to Google Web Toolkit
Stupid question... Using googlipse and GWT and gwt-widgets, where does
the gwt-widget jar file get included? I could compile using the
gwt-widget SimpleDateFormat class, but I couldn't get it to run even in
hosted mode. Probably something stupid (I *did* remember to inherit
the classes, I promise...).

Owen

adrian carr

unread,
Oct 3, 2006, 10:07:38 PM10/3/06
to Google Web Toolkit
Thanks Jason. That is exactly what I was looking for. I looked all
over, but just didn't find it.

Reply all
Reply to author
Forward
0 new messages