Loading classes at runtime
I am trying to write a Java program that accepts command line arguments which
specify classes to be loaded. Can I use the functions from the Class class
to do this? The program will not know the names of the classes until it
is run, however, it will know that all of the classes that it might encounter
extend a given class. For instance, on the command line the user will type:
java MyProgram A B (where A and B are classes that both extend class Letter).
Then, MyProgram's main function will create an instance of A and an instance
Any help you can give would be greatly appreciated.
Re: Loading classes at runtime
firstname.lastname@example.org (Shayne) wrote in <email@example.com>:
>I am trying to write a Java program that accepts command line arguments
>which specify classes to be loaded. Can I use the functions from the
>Class class to do this?
See Class.forName() and Class.newInstance().