Check whether the current classpath already contains our jasper libraries and dependencies or not.

Without validating this the classpath would grow and contain duplicated references with every jasper report you print.
This commit is contained in:
deathmeat 2007-08-20 15:07:57 +00:00
parent bc451d1044
commit f445ee98c7
1 changed files with 10 additions and 5 deletions

View File

@ -816,11 +816,16 @@ public class ReportStarter implements ProcessCall {
if(jasperreportsAbsolutePath != null && !jasperreportsAbsolutePath.trim().equals("")) if(jasperreportsAbsolutePath != null && !jasperreportsAbsolutePath.trim().equals(""))
{ {
System.setProperty("java.class.path", // Check whether the current CLASSPATH already contains our
System.getProperty("java.class.path") + // jasper libraries and dependencies or not.
System.getProperty("path.separator") + if(System.getProperty("java.class.path").indexOf(jasperreportsAbsolutePath) < 0)
jasperreportsAbsolutePath); {
log.info("Classpath has been corrected to " + System.getProperty("java.class.path")); System.setProperty("java.class.path",
System.getProperty("java.class.path") +
System.getProperty("path.separator") +
jasperreportsAbsolutePath);
log.info("Classpath has been corrected to " + System.getProperty("java.class.path"));
}
} }
} }