Hi I have a piece of code but at run time is giving me this error:
Exception in thread "main" java.lang.ExceptionInInitializerError
at com.google.gwt.maps.client.geocode.DirectionQueryOptions.<init>
(DirectionQueryOptions.java:62)
at com.google.gwt.maps.client.geocode.DirectionQueryOptions.<init>
(DirectionQueryOptions.java:39)
at com.secureorigins.analysis.Route.main(Route.java:22)
Caused by: java.lang.UnsupportedOperationException: ERROR: GWT.create
() is only usable in client code! It cannot be called, for example,
from server code. If you are running a unit test, check that your
test case extends GWTTestCase and that GWT.create() is not called from
within an initializer or constructor.
at com.google.gwt.core.client.GWT.create(GWT.java:91)
at com.google.gwt.maps.client.impl.DirectionQueryOptionsImpl.<clinit>
(DirectionQueryOptionsImpl.java:32)
... 3 more
This is the piece of code:
import com.google.gwt.maps.client.geocode.DirectionQueryOptions;
import com.google.gwt.maps.client.geocode.DirectionResults;
import com.google.gwt.maps.client.geocode.Directions;
import com.google.gwt.maps.client.geocode.DirectionsCallback;
import com.google.gwt.maps.client.geocode.Distance;
import com.google.gwt.maps.client.geocode.Duration;
import com.google.gwt.maps.client.geocode.StatusCodes;
/**
* @author rsoto
*
*/
public class Route {
/**
* @param args
*/
public static void main(String args[]){
DirectionQueryOptions opts = new DirectionQueryOptions();
String query = "from: 10424 Eaglestone el Paso tx to: 500 West
Overland El Paso TX";
Directions.load(query, opts, new DirectionsCallback() {
public void onFailure(int statusCode) {
System.out.println("Failed to load directions:
Status "
+
StatusCodes.getName(statusCode) + " " + statusCode);
}
public void onSuccess(DirectionResults result) {
Distance dis = result.getDistance();
Duration duration = result.getDuration();
System.out.println("The distance is: " + dis);
System.out.println("The travel duration is: " +
duration);
}
});
}
}
Any help will be appreciated.
Thank you,
rsoto
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---