To do this, go to the Eclipse project settings and select 'Java Build
Path', 'Libraries'. Open the entry for your JDK/JRE library, and select
'Access Rules', then 'Edit'. You need to add 3 rules, in this order:
Accessible : java/lang/*
Accessible : java/util/*
Forbidden : **
This will stop Eclipse from offering you JRE classes outside
java.[lang|util], and will also give you an error if you manually type
one in. Obviously, you'd get an error anyway if you attempted to run it
in GWT hosted mode, but more immediate feedback is always a good thing!
In addition you can set the project-specific Java Compiler source
compatability level to Java v1.4 - so you don't accidentally start
using generics or other unavailable language features.
Roberto
http://code.google.com/webtoolkit/gettingstarted.html#NewEclipse
-there are even scripts (projectCreator & applicationCreator) to create
blank GWT Eclipse projects.
I''m using a slightly different file layout to that recommended in the
standard GWT package layout
(http://code.google.com/webtoolkit/documentation/com.google.gwt.doc.DeveloperGuide.Fundamentals.ProjectStructure.html)
- basically because I want to be able to code GWT client-side within
as restricted environment as possible, yet also compile my server side
code in a full-fat mustang-with-a-banana environment. Eclipse only lets
you set one compiler complience level and build path per project, so
this requires two projects, eg. myapp-server & myapp-gwt. The file
layout ends up looking like this:
myapp-server/src/com/example/cal/server/spelling/SpellingServiceImpl.java
myapp-gwt/src/com/example/cal/client/spelling/SpellingService.java
myapp-gwt/src/com/example/cal/public/Calendar.html
It's working pretty well for me so far.
cheers,
Roberto