I recently saw that there has been lots of discussion on the custom rest service legend sample posted on the code gallery in terms of getting the sample up and running successfully. If you have no clue on what I am talking about, here is the link.
This post should help you get the sample running in no time (almost):
I am using Eclipse (screen-shots show version 3.4/Ganymede, 3.3/Europa should work as well) as my IDE and ArcGIS Server 9.3.1 Java ADF libraries.
1. Download the sample on to the disk:
The sample comes with “json.jar” library, as shown in the screen-shot here:
2. Create a new project in eclipse
3. Import the source files and web-inf folder from the sample to the project
As you see, IDE complains that there are missing imports. We are going to fix them in step 4
4. Copy (drag and drop) the following libraries into the project from the Web ADF library collection
Note: You do not need ArcGIS Server to run this sample, just the Java Web ADF libraries is good. You can copy the required libraries from other machine if needed
After completing steps 3 and 4 you project should look like:
5. Run the web app (Assumption is that you have eclipse configured with web server like tomcat or jetty. I am using tomcat 6)
6. Optionally, you can export this into a war file for deployment