If you just want to get resources, you can use url.openStream() (see http://java.sun.com/docs/books/tutorial/networking/urls/readingURL.html)
There are some problems if you try to run it with Eclipse:
- You might see compile errors saying Access restriction: The type … is not accessible due to restriction on required library …
The problem here is that the HTTP server used in that project is part of the Sun JRE6 but not part of standardized Java.
Eclipse therefore blocks access to it.
This can be fixed by going to the Window->Preferences window, selecting Java->Compiler->Errors/Warnings,
selecting Deprecated and Restricted API and then changing the setting for Forbidden Reference and Discouraged Reference to Warning instead of Error.
- Running it with the embedded maven gives an error: INFO: Scanning for root resource and provider classes in the paths:
/usr/local/eclipse-3.4.2/plugins/org.maven.ide.components.maven_embedder_2.1.0.20080530-2300/jars/plexus-classworlds-1.2-alpha-12.jar
May 5, 2009 6:41:42 PM com.sun.jersey.server.impl.application.WebApplicationImpl processRootResources
SEVERE: The ResourceConfig instance does not contain any root resource classes.
The solution is to configure an external Maven install.
- Running it with JUnit in Eclipse works (doesn't) uses Maven.
Bruno
]]>