Top Description Fields Constructors Methods
org.apache.bcel.util

public Class JavaWrapper

extends Object
Class Inheritance
Imports
java.lang.reflect.Method, .Modifier, org.apache.commons.lang3.StringUtils

Java interpreter replacement, i.e., 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

Field Summary

Modifier and TypeField and Description
private final ClassLoader

Constructor Summary

AccessConstructor and Description
public
public
JavaWrapper(final ClassLoader loader)

Method Summary

Modifier and TypeMethod and Description
private static ClassLoader
public static void
main(final String[] argv)

Default main method used as wrapper, expects the fully qualified class name of the real class as the first argument.

public void
runMain(final String
the fully qualified class name
className
,
final String[]
the arguments just as you would pass them directly
argv
)

Runs the main method of the given class with the arguments passed in argv

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

loaderback to summary
private final ClassLoader loader

Constructor Detail

JavaWrapperback to summary
public JavaWrapper()
JavaWrapperback to summary
public JavaWrapper(final ClassLoader loader)

Method Detail

getClassLoaderback to summary
private static ClassLoader getClassLoader()
mainback to summary
public static void main(final String[] argv) throws Exception

Default main method used as wrapper, expects the fully qualified class name of the real class as the first argument.

runMainback to summary
public void runMain(final String className, final String[] argv) throws ClassNotFoundException

Runs the main method of the given class with the arguments passed in argv

Parameters
className:String

the fully qualified class name

argv:String[]

the arguments just as you would pass them directly

Exceptions
ClassNotFoundException:
if className can't be found.