COMP 405
|
Java EE Tips and
Traps
|
 |
"Cannot get the System Java Compiler. Please use a JDK, not a JRE"
error
First, try changing the default JRE that Eclipse uses (Preferences/Java/Installed
JREs) to be a JDK, not a JRE. If that doesn't work, try the
following:
Edit the eclipse.ini file (must start your ASCII editor "As
Administrator" in Windows) and add the following lines, right above the
"-vmargs" line:
-vm
[java executable location] e.g. C:\Program
Files\Java\jdk1.7.0_17\bin\javaw.exe
Ref:
http://wiki.eclipse.org/Eclipse.ini
Upgrading Eclipse with GWT and GAE
plugins
Sooner or later you will need to upgrade Eclipse and/or its GAE and GWT
plugins. Unfortunately, the upgrade process may not be as
smooth as one wishes. Here are some issues to be aware of:
- Commit your code before doing any upgrades!
- The main Eclipse application update may require that Eclipse be "Run
As Administrator". The indication is that Eclipse will not
allow you to select this particular upgrade because it says that you have
insufficient privileges to perform that update.
- After an AppEngine SDK update, the project may be using an incorrect and
possibly now invalid GAE SDK.
- Go to Preferences/Google/App Engine
to select the updated SDK and remove any old, invalid SDKs.
- Check to make sure that your project's settings:
- Java Build path has been updated to use the updated SDK (Project/Properties/Java
Build Path/Libraries)
- The
appengine-api-x.x-sdk-y.y.y.jar file in the
war/WEB-INF/lib folder has been
updated to the new version.
- After an Google Web Toolkit update, the project may be using an
incorrect and possibly now invalid GWT SDK.
- Go to Preferences/Google/Web Toolkit
to select the updated SDK and remove any old, invalid SDKs.
- Check to make sure that your project's settings:
- Java Build path has been updated to use the updated GWT SDK (Project/Properties/Java
Build Path/Libraries)
- Make sure that all team members perform the update right away so
that incorrect versions of SDK JAR files aren't committed into the
repository which could cause problems on other people's machines.
- Be sure to clean the project (Project/Clean...)
and to redo the GWT compile (make sure that the Development Mode
server is not running when you do this!).
- If the GWT compile fails, try deleting the
gwt-unitCache folder. This will force the GWT compiler to
recompile everything and hopefully get rid of any cross-version
inconsistencies.
© 2013 by Stephen Wong