+ if (systemPropertiesFileProperty == null) {
+ // pass system properties as argument
+ for (Map.Entry<Object, Object> entry : systemProperties.entrySet()) {
+ command.add("-D" + entry.getKey() + "=" + entry.getValue());
+ }
+ } else {
+ // write system properties in a file to work around OS limitations
+ // with command line (e.g. Win XP)
+ String dir = systemPropertiesFileDir;
+ if (dir == null)
+ dir = getExecDirToUse();
+ String fileName = systemPropertiesFileName;
+ if (fileName == null)
+ fileName = systemPropertiesFileProperty + ".properties";
+
+ // Write file
+ FileOutputStream fos = null;
+ File file = new File(dir + File.separator + fileName);
+ try {
+
+ if (!file.getParentFile().exists())
+ file.getParentFile().mkdirs();
+ fos = new FileOutputStream(file);
+ systemProperties.store(fos, "Automatically generated by "
+ + getClass());
+ command.add("-D" + systemPropertiesFileProperty + "="
+ + file.getCanonicalPath());
+ } catch (IOException e) {
+ throw new SlcException("Cannot write to system properties to "
+ + file, e);
+ } finally {
+ IOUtils.closeQuietly(fos);
+ }