1

I am developing a facility that will execute a java unit test.

The system will need to compile a .java file (from outside the working directory) at runtime and "import" the outputted .class file. This .class file will then be executed using the JUnitCore runClasses() command. Am I right in thinking that the URLClassLoader is the correct approach?

How should I go about loading the class with the URLClassLoader? Can the output of this this be passed to the runClasses() method?

Any help with this would be most appreciated.

1 Answers1

1

runClasses() takes Class as a parameter, so it should work with the output from URLClassLoader. You're probably looking for this: Method to dynamically load java class files

Community
  • 1
  • 1
Jad
  • 922
  • 8
  • 14