by using web.xml:
<servlet>
<servlet-name>jersey-servlet</servlet-name>
<servlet-class>com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>com.sun.jersey.config.property.packages</param-name>
<param-value>com.foo.resources;org.bar.resources</param-value>
</init-param>
</servlet>
or in Java (without a servlet container):
public class MyConfig extends PackagesResourceConfig {
public MyApplication() {
super("com.foo.resources;org.bar.resources");
}
}
or subclassing Application:
public class MyApplicaton extends Application {
public Set<Class<?>> getClasses() {
Set<Class<?>> s = new HashSet<Class<?>>();
s.add(com.foo.resources.MyResource.class);
return s;
}
}