Package org.apache.bcel.util
Class JavaWrapper
- java.lang.Object
-
- org.apache.bcel.util.JavaWrapper
-
public class JavaWrapper extends java.lang.Object
Java interpreter replacement, that is, wrapper that uses its own ClassLoader to modify/generate classes as they're requested. You can take this as a template for your own applications.Call this wrapper with:
java org.apache.bcel.util.JavaWrapper <real.class.name> [arguments]
To use your own class loader you can set the "bcel.classloader" system property.
java org.apache.bcel.util.JavaWrapper -Dbcel.classloader=foo.MyLoader <real.class.name> [arguments]
- See Also:
ClassLoader
-
-
Constructor Summary
Constructors Constructor Description JavaWrapper()Constructs a JavaWrapper with the default class loader.JavaWrapper(java.lang.ClassLoader loader)Constructs a JavaWrapper with the specified class loader.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidmain(java.lang.String[] argv)Default main method used as wrapper, expects the fully qualified class name of the real class as the first argument.voidrunMain(java.lang.String className, java.lang.String[] argv)Runs the main method of the given class with the arguments passed in argv
-
-
-
Constructor Detail
-
JavaWrapper
public JavaWrapper()
Constructs a JavaWrapper with the default class loader.
-
JavaWrapper
public JavaWrapper(java.lang.ClassLoader loader)
Constructs a JavaWrapper with the specified class loader.- Parameters:
loader- The class loader to use.
-
-
Method Detail
-
main
public static void main(java.lang.String[] argv) throws java.lang.Exception
Default main method used as wrapper, expects the fully qualified class name of the real class as the first argument.- Parameters:
argv- command line arguments where first argument is the class name.- Throws:
java.lang.Exception- Thrown if an error occurs during execution.
-
runMain
public void runMain(java.lang.String className, java.lang.String[] argv) throws java.lang.ClassNotFoundException
Runs the main method of the given class with the arguments passed in argv- Parameters:
className- The fully qualified class name.argv- The arguments just as you would pass them directly.- Throws:
java.lang.ClassNotFoundException- Thrown ifclassNamecan't be found.
-
-