You can use a static initialization block which will run once the class is loaded:
public class MyServlet {
static final Dictionary stuff = new Hashtable();
static {
// load files
}
// ...
}
This technique is not special to jax-rs/jersey or any other framework, it's a language feature.
Move the code to a method if you want to be able to call it again later:
public class MyServlet {
static final Dictionary stuff = new Hashtable();
static {
// load at startup
reloadDictionary();
}
// call this whenever you want to reload the files
static void reloadDictionary() {
// reload files
}
// ...
}