We in the process of migrating to JBOSS 6 and make use of the Java Compiler in the application server. In 4.x, we used to do obtain the class path by using this code:
if (cl instanceof UnifiedClassLoader) {
UnifiedClassLoader ucl = (UnifiedClassLoader)cl;
for (URL url : ucl.getClasspath()) {
cp.append(url.getPath());
cp.append(File.pathSeparatorChar);
}
}
In JBOSS 6, cl is now a BaseClassLoader. we have not found a way to obtain the same list from this class loader. We must be missing something very obvious. Any help will be greatly appreciated.
Thank you,
Tarek Hammoud
We must be missing something very obvious.
Not really, this was done on purpose. ;-)
But you can easily access classpath as part of deployment process.
See VDF and/or check Deployer, DeploymentUnit API.