Package org.codehaus.commons.compiler
Class AbstractJavaSourceClassLoader
java.lang.Object
java.lang.ClassLoader
org.codehaus.commons.compiler.AbstractJavaSourceClassLoader
- Direct Known Subclasses:
JavaSourceClassLoader
,JavaSourceClassLoader
A
ClassLoader
that, unlike usual ClassLoader
s, does not load byte code, but reads Java™ source
code and then scans, parses, compiles and loads it into the virtual machine.
As with any ClassLoader
, it is not possible to "update" classes after they've been loaded. The way to
achieve this is to give up on the AbstractJavaSourceClassLoader
and create a new one.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interface
-
Field Summary
FieldsModifier and TypeFieldDescription -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
Read Java™ source code for a given class name, scan, parse, compile and load it into the virtual machine, and invoke its "main()" method with the given arguments.abstract void
setDebuggingInfo
(boolean lines, boolean vars, boolean source) final void
setProtectionDomainFactory
(AbstractJavaSourceClassLoader.ProtectionDomainFactory optionalProtectionDomainFactory) abstract void
setSourceFileCharacterEncoding
(String optionalCharacterEncoding) abstract void
setSourcePath
(File[] sourcePath) Methods inherited from class java.lang.ClassLoader
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findClass, findClass, findLibrary, findLoadedClass, findResource, findResource, findResources, findSystemClass, getClassLoadingLock, getDefinedPackage, getDefinedPackages, getName, getPackage, getPackages, getParent, getPlatformClassLoader, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, getUnnamedModule, isRegisteredAsParallelCapable, loadClass, loadClass, registerAsParallelCapable, resolveClass, resources, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
-
Field Details
-
optionalProtectionDomainFactory
- See Also:
-
-
Constructor Details
-
AbstractJavaSourceClassLoader
public AbstractJavaSourceClassLoader() -
AbstractJavaSourceClassLoader
-
-
Method Details
-
setSourcePath
- Parameters:
sourcePath
- The sequence of directories to search for Java™ source files
-
setSourceFileCharacterEncoding
- Parameters:
optionalCharacterEncoding
- ifnull
, use platform default encoding
-
setDebuggingInfo
public abstract void setDebuggingInfo(boolean lines, boolean vars, boolean source) - Parameters:
lines
- Whether line number debugging information should be generatedvars
- Whether variables debugging information should be generatedsource
- Whether source file debugging information should be generated
-
setProtectionDomainFactory
public final void setProtectionDomainFactory(AbstractJavaSourceClassLoader.ProtectionDomainFactory optionalProtectionDomainFactory) - See Also:
-
main
Read Java™ source code for a given class name, scan, parse, compile and load it into the virtual machine, and invoke its "main()" method with the given arguments.Usage is as follows:
java
AbstractJavaSourceClassLoader
[ option ] ... class-name [ argument ] ... option: -sourcepath colon-separated-list-of-source-directories -encoding character-encoding -g Generate all debugging info -g:none Generate no debugging info -g:{source,lines,vars} Generate only some debugging info- Throws:
Exception
-