// How to start up some other Java program when you don't // know its name at compile time. // Have all your dynamically loaded classes implement a common interface, // called here Delegate. For his method to work, you need the source code for all // dynamic classes, or the power to ensure they all implement some common interface. // You might get the list of possible dynamic class names // from a run-time properties file or by doing a File.list Delegate d = (Delegate) ( Class.forName( "com.mysite.mypackage." + nameOfClass ) .newInstance() ); // To get better control of exceptions, you might use reflection on the constructor // in place of newInstance. // Now you can invoke instance methods on your delegate. // Interfaces don't have any static methods, though you can cast your // interfaces to classes that do. d.doSomething();