您可以在服务器上线之前运行负载。您尚未指定如何加载服务器,类以及环境是什么,但是可以利用以下事实:加载类时将运行类静态初始化程序。因此,如果您从“
main”方法运行,则您的类可能看起来像这样
public class Foo { static { //this will be run when the class is loaded try { Class.forName("fully.qualified.class.name.that.i.want.to.Load"); } catch ... } public static void main (string args[]) { //run my server... }}


