Author: chatellier Date: 2011-07-18 16:13:13 +0000 (Mon, 18 Jul 2011) New Revision: 3450 Log: Fix R parameters initialisation for sub process launch Modified: isis-fish/branches/isis-fish-3.3.0.x/changelog.txt isis-fish/branches/isis-fish-3.3.0.x/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java Modified: isis-fish/branches/isis-fish-3.3.0.x/changelog.txt =================================================================== --- isis-fish/branches/isis-fish-3.3.0.x/changelog.txt 2011-07-18 15:48:03 UTC (rev 3449) +++ isis-fish/branches/isis-fish-3.3.0.x/changelog.txt 2011-07-18 16:13:13 UTC (rev 3450) @@ -1,3 +1,9 @@ +isis-fish (3.3.0.9) stable; urgency=low + + * Fix R parameters initialisation for sub process launch + + -- lun. juil. 18 18:12:49 CEST 2011 + isis-fish (3.3.0.8) stable; urgency=low * Fix NullPointerException with length change matrix Modified: isis-fish/branches/isis-fish-3.3.0.x/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java =================================================================== --- isis-fish/branches/isis-fish-3.3.0.x/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2011-07-18 15:48:03 UTC (rev 3449) +++ isis-fish/branches/isis-fish-3.3.0.x/src/main/java/fr/ifremer/isisfish/simulator/launcher/SubProcessSimulationLauncher.java 2011-07-18 16:13:13 UTC (rev 3450) @@ -36,6 +36,7 @@ import java.net.URLClassLoader; import java.rmi.RemoteException; import java.util.ArrayList; +import java.util.List; import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; @@ -185,21 +186,44 @@ log.debug("classpath to use : " + classpath); } + // common args + List<String> command = new ArrayList<String>(); + command.add(java); + command.add("-Xmx1024M"); + + // jri args + String libraryPath = System.getProperty("java.library.path"); + if (StringUtils.isNotBlank(libraryPath)) { + command.add("-Djava.library.path=\"" + libraryPath + "\""); + } + String rType = System.getProperty("R.type"); + if (StringUtils.isNotBlank(rType)) { + command.add("-DR.type=\"" + rType + "\""); + } + + // common args + command.add("-classpath"); + command.add(classpath); + command.add(IsisFish.class.getName()); + command.add("--option"); + command.add("launch.ui"); + command.add("false"); + // prepare le process ProcessBuilder processBuilder = null; if (tempPrescriptFile != null) { - processBuilder = new ProcessBuilder(java, "-Xmx1024M", "-classpath", - classpath, IsisFish.class.getName(), "--option", "launch.ui", - "false", "--simulateWithSimulationAndScript", simulationId, - simulationZip.getAbsolutePath(), tempPrescriptFile.getAbsolutePath()); + command.add("--simulateWithSimulationAndScript"); + command.add(simulationId); + command.add(simulationZip.getAbsolutePath()); + command.add(tempPrescriptFile.getAbsolutePath()); } else { - processBuilder = new ProcessBuilder(java, "-Xmx1024M", "-classpath", - classpath, IsisFish.class.getName(), "--option", "launch.ui", - "false", "--simulateWithSimulation", simulationId, - simulationZip.getAbsolutePath()); + command.add("--simulateWithSimulation"); + command.add(simulationId); + command.add(simulationZip.getAbsolutePath()); } + processBuilder = new ProcessBuilder(command); processBuilder.redirectErrorStream(true); // demarrage du process