JVM Module

This module provides access to class files compiled in the current workspace. Typically these files will be derived from .java files, but this module accepts any source that compiles to .class files.

Dependencies

This module depends on following other modules which will automatically be loaded.

Method Overview

Method Description
compile() Retrieve class for a given JRE resource.
createInstance() Create an instance of a given JRE resource.
invokeStatic() Invoke a static method on a given JRE resource.

Methods

compile

Class<T> compile(Object location)

Retrieve class for a given JRE resource.

location
file location to look for

class instance

ClassNotFoundException
when class cannot be found
JavaModelException
when the workspace project model is invalid
MalformedURLException
when references in the project are invalid

createInstance

Object createInstance(String location)

Create an instance of a given JRE resource. The default constructor is used to create the class instance.

location
file location to look for

class instance

ClassNotFoundException
when class cannot be found
JavaModelException
when the workspace project model is invalid
MalformedURLException
when references in the project are invalid
InstantiationException
when class cannot be instantiated
IllegalAccessException
when class access is not granted

invokeStatic

Object invokeStatic(String location, String methodName)

Invoke a static method on a given JRE resource.

location
file location to look for
methodName
method to invoke

invoked method result

ClassNotFoundException
when class cannot be found
JavaModelException
when the workspace project model is invalid
MalformedURLException
when references in the project are invalid
NoSuchMethodException
if a matching method is not found or if the name is "<init>"or "<clinit>".
SecurityException
If a security manager, s, is present and the caller's class loader is not the same as or an ancestor of the class loader for the current class and invocation of s.checkPackageAccess() denies access to the package of this class.
IllegalAccessException
if this Method object is enforcing Java language access control and the underlying method is inaccessible.
IllegalArgumentException
if the method is an instance method and the specified object argument is not an instance of the class or interface declaring the underlying method (or of a subclass or implementor thereof); if the number of actual and formal parameters differ; if an unwrapping conversion for primitive arguments fails; or if, after possible unwrapping, a parameter value cannot be converted to the corresponding formal parameter type by a method invocation conversion.
InvocationTargetException
if the underlying method throws an exception.