Showing posts with label eclipse. Show all posts
Showing posts with label eclipse. Show all posts

Friday, 20 January 2012

Fixing missing Jar files from WEB-INF/lib when you import a web project into Eclipse

If you import an existing web project into Eclipse you may see various errors reporting missing libraries in the WEB-INF/lib directory. 

The simplest way to fix the issue is to just right-click on one of the errors and select the Quick Fix option:

Quick fix -> Synchronize <WAR>/WEB-INF/lib with SDK libraries

This will copy the jar files into WEB-INF/lib.

Friday, 2 December 2011

Error: The RequestFactory ValidationTool must be run for GWT 2.4

When loading up the CloudTasks tutorial as downloaded from the Google website, I encountered the following Runtime error:

SEVERE: Unexpected error
java.lang.RuntimeException: The RequestFactory ValidationTool must be run for the com.cloudtasks.shared.CloudTasksRequestFactory RequestFactory type

I found this article:

http://code.google.com/p/google-web-toolkit/wiki/RequestFactoryInterfaceValidation

Here's an excerpt:
The RequestFactory annotation processor will validate the RequestFactory interface declarations and ensure that the mapping of proxy properties and context methods to their domain types is valid. The manner in which the errors are reported depends on the method by which the annotation processor is invoked.
In addition to validating the interfaces, the annotation processor also generates additional Java types which embed pre-computed metadata that is required by the RequestFactory server components. Users of RequestFactorySource must also run the annotation processor in order to provide the client code with obfuscated type token mappings. In the client-only case, the server domain types are not required.
If the validation process is not completed, a runtime error message will be generated:
The RequestFactory ValidationTool must be run for the com.example.shared.MyRequestFactory RequestFactory type
In GWT 2.4, RequestFactory interfaces must be validated before they can be used by the RequestFactory server code or JVM-based clients. I followed the instructions for Eclipse as follows:
  • Right-click on Project and select Properties > Java Compiler > Annotation Processing
  • Tick "Enable project specific settings"
  • Then make sure that both "Enable annotation processing" and "Enable processing in editor" are ticked.
  • Go to Factory Path underneath Annotation Processing in the left-hand menu
  • Click the button "Add External Jar"
  • Add the requestfactory-apt.jar file from your Eclipse distribution
  • Press Apply and the project will re-build.
The images on the above link ask you to add this file from GWT_TOOLS, but the text says to use your distribution. I found my file under:

C:\dev\eclipse-3.5.2\plugins\com.google.gwt.eclipse.sdkbundle_2.4.0.relr35v201110112027\gwt-2.4.0

Thursday, 1 December 2011

Eclipse Android Library Error: Unable to get system library for the project

I downloaded some code via subclipse from the SVN server of Google to follow a tutorial. However, eclipse didn't know that it was an Android project and wouldn't let me build it as one no matter how many different ways I tried to add the android jar file. I found this great discussion on StackOverflow but this is what was wrong for me:
  • Right click on project > Properties > Android
  • Set Project build target (mine was ICS Android 4
  • Press Apply (I had to press apply 3 times for it to listen to me!)
  • Then go to Build Configuration and set the "Unable to get system library for the project" libraries Native folder to your Android jar (something like  C:/dev/AndroidSDK/platforms/android-14)
  • Right click on project > Android Tools > Fix Project Properties
  • Clean & Build
  • If nothing, try opening and closing the project
  • Also try pressing Apply on the build target some more
Sounds silly, but eclipse can be silly sometimes too!
Obviously check to make sure that you've set the Android SDK location in Window > Preferences > Android. My SDK location is C:\dev\AndroidSDK (not sure why eclipse holds the backslashes here and forward slashes above)