Index: tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java
===================================================================
--- tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java	(revision 2503)
+++ tmp/org.txm.statsengine.r.core/src/org/txm/statsengine/r/core/StartRserve.java	(revision 2504)
@@ -58,15 +58,15 @@
  * Rserve instance.
  */
 public class StartRserve {
-
+	
 	/** shortcut to <code>launchRserve(cmd, "--no-save --slave", "--no-save --slave", false)</code>. */
 	public static Process rProcess;
-
+	
 	/**
 	 * Launch rserve.
 	 *
 	 * @param cmd the cmd
-	 * @param options 
+	 * @param options
 	 * @return true, if successful
 	 */
 	protected static boolean launchRserve(String cmd, int port, boolean debug, String rArgs, String rServeArgs) {
@@ -74,9 +74,9 @@
 				&& new File(cmd).canExecute())
 			return launchRserve(cmd,
 					"--no-save --encoding utf8 " + rArgs, "--RS-encoding utf8 --no-save --encoding utf8 " + rServeArgs, port, debug); //$NON-NLS-1$ //$NON-NLS-2$
-		return false;//checkLocalRserve(port, debug, rArgs, rServeArgs);
+		return false;// checkLocalRserve(port, debug, rArgs, rServeArgs);
 	}
-
+	
 	/**
 	 * attempt to start Rserve. Note: parameters are <b>not</b> quoted, so avoid
 	 * using any quotes in arguments
@@ -86,42 +86,42 @@
 	 * @param rsrvargs arguments to be passed to Rserve
 	 * @param debug the debug
 	 * @return <code>true</code> if Rserve is running or was successfully
-	 * started, <code>false</code> otherwise.
+	 *         started, <code>false</code> otherwise.
 	 */
 	protected static boolean launchRserve(String cmd, String rargs, String rsrvargs, int port, boolean debug) {
-		//System.out.println("LAUNCH R SERVER "+cmd+" "+port+" "+debug);
+		// System.out.println("LAUNCH R SERVER "+cmd+" "+port+" "+debug);
 		try {
 			String[] cmdline = null;
+			
 			// FIXME: don't forget to remove this Window dedicated code if we manage to use http_proxy command line argument
+			// Windows OS
 			boolean isWindows = false;
-			
-			// Windows OS
 			if (OSDetector.isFamilyWindows()) {
 				isWindows = true; /* Windows startup */
 				
 				
 				// TODO: old tests for setting proxy in R
-				//Windows : set --internet2 option to manage proxy if any
+				// Windows : set --internet2 option to manage proxy if any
 				
-//				// set Proxy configuration using Eclipse RCP stored values
-//				String proxy_conf = "";
-//				ProxyConf conf = new ProxyConf(RWorkspace.getRWorkspaceInstance());
-//				if (conf.mustSetProxyConfiguration()) {
-//					proxy_conf = "http_proxy="+conf.getHttpProxyUrl();
-//					rsrvargs += " "+proxy_conf; // add the http_proxy parameter
-//					Log.info("Run Rserve with proxy configuration: "+proxy_conf);
-//				}
+				// // set Proxy configuration using Eclipse RCP stored values
+				// String proxy_conf = "";
+				// ProxyConf conf = new ProxyConf(RWorkspace.getRWorkspaceInstance());
+				// if (conf.mustSetProxyConfiguration()) {
+				// proxy_conf = "http_proxy="+conf.getHttpProxyUrl();
+				// rsrvargs += " "+proxy_conf; // add the http_proxy parameter
+				// Log.info("Run Rserve with proxy configuration: "+proxy_conf);
+				// }
 				
 				cmdline = new String[] {
 						cmd,
-						rargs, 
+						rargs,
 						"-e", //$NON-NLS-1$
-						"library(Rserve);run.Rserve(" //$NON-NLS-1$ 
-						+ (debug ? "TRUE" : "FALSE")  //$NON-NLS-1$ //$NON-NLS-2$
-						+ ",port=" + port + "" //$NON-NLS-1$ //$NON-NLS-2$
-						+ ",args='" //$NON-NLS-1$
-						+ rsrvargs + "')\" " //$NON-NLS-1$
-				};	
+						"library(Rserve);run.Rserve(" //$NON-NLS-1$
+								+ (debug ? "TRUE" : "FALSE")  //$NON-NLS-1$ //$NON-NLS-2$
+								+ ",port=" + port + "" //$NON-NLS-1$ //$NON-NLS-2$
+								+ ",args='" //$NON-NLS-1$
+								+ rsrvargs + "')\" " //$NON-NLS-1$
+				};
 			}
 			// Mac, Linux
 			else {
@@ -129,67 +129,74 @@
 						"/bin/sh", //$NON-NLS-1$
 						"-c", //$NON-NLS-1$
 						"echo 'library(Rserve);run.Rserve(" //$NON-NLS-1$
-						+ (debug ? "TRUE" : "FALSE") //$NON-NLS-1$ //$NON-NLS-2$
-						+ ",port="+port+"" //$NON-NLS-1$ //$NON-NLS-2$
-						+ ",args=\"" + rsrvargs //$NON-NLS-1$
-						+ "\")'|" + cmd //$NON-NLS-1$ 
-						+ " " + rargs }; //$NON-NLS-1$
+								+ (debug ? "TRUE" : "FALSE") //$NON-NLS-1$ //$NON-NLS-2$
+								+ ",port=" + port + "" //$NON-NLS-1$ //$NON-NLS-2$
+								+ ",args=\"" + rsrvargs //$NON-NLS-1$
+								+ "\")'|" + cmd //$NON-NLS-1$
+								+ " " + rargs }; //$NON-NLS-1$
 			}
-
-//			ProcessBuilder builder = new ProcessBuilder(cmdline);
-//			Rserveprocess = builder.start();
-
+			
+			// ProcessBuilder builder = new ProcessBuilder(cmdline);
+			// Rserveprocess = builder.start();
+			
 			Runtime runtime = Runtime.getRuntime();
 			Log.fine(RCoreMessages.bind(RCoreMessages.info_startingRWithCommandLine, StringUtils.join(cmdline, " "))); //$NON-NLS-1$
 			rProcess = runtime.exec(cmdline);
 			
-			//Log.info(Messages.StartRserve_0+Arrays.toString(cmdline));
+			// Log.info(Messages.StartRserve_0+Arrays.toString(cmdline));
 			StreamHog errStream = new StreamHog(rProcess.getErrorStream(), RWorkspace.isLoggingEvalCommandLines());
 			errStream.setName("R-err");
 			StreamHog inStream = new StreamHog(rProcess.getInputStream(), RWorkspace.isLoggingEvalCommandLines());
 			inStream.setName("R");
 			RWorkspace.getRWorkspaceInstance().registerLogger(errStream, inStream);
-
-			//if (!debug && !isWindows) Rserveprocess.waitFor();
+			
+			// if (!debug && !isWindows) Rserveprocess.waitFor();
 			// System.out.println("call terminated, let us try to connect ...");
-		} catch (Exception x) {
+		}
+		catch (Exception x) {
 			Log.severe(RCoreMessages.error_failedToStartRServeWithCommand + x.getMessage());
 			return false;
 		}
-
+		
 		Log.fine(RCoreMessages.info_statisticsEngineLaunched);
-
+		
 		try {
 			Thread.sleep(200);
-		} catch (InterruptedException ix) { }
-
+		}
+		catch (InterruptedException ix) {
+		}
+		
 		int attempts = 10;
 		while (attempts > 0) {
 			try {
-				//System.out.print("."); //$NON-NLS-1$
+				// System.out.print("."); //$NON-NLS-1$
 				RConnection c = new RConnection("127.0.0.1", port); //$NON-NLS-1$
 				c.close();
 				return true;
-			} catch (Exception e2) {
+			}
+			catch (Exception e2) {
 				try {
 					Thread.sleep(1500);
-				} catch (InterruptedException ix) { }
+				}
+				catch (InterruptedException ix) {
+				}
 			}
-
+			
 			attempts--;
 		}
 		Log.fine("R connection attemps done.");
 		return false;
 	}
-
+	
 	/**
 	 * checks whether Rserve is running and if that's not the case it attempts
 	 * to start it using the defaults for the platform where it is run on. This
 	 * method is meant to be set-and-forget and cover most default setups. For
 	 * special setups you may get more control over R with <
 	 * <code>launchRserve</code> instead.
-	 * @param rServeArgs 
-	 * @param rargs 
+	 * 
+	 * @param rServeArgs
+	 * @param rargs
 	 *
 	 * @return true, if successful
 	 */
@@ -200,33 +207,33 @@
 			return true;
 		}
 		// Windows OS
-//		if (OSDetector.isFamilyWindows()) {
-//			// System.out.println("Windows: query registry to find where R is installed ...");
-//			String installPath = null;
-//			try {
-//				Process rp = Runtime.getRuntime().exec("reg query HKLM\\Software\\R-core\\R"); //$NON-NLS-1$
-//				StreamHog regHog = new StreamHog(rp.getInputStream(), true);
-//				rp.waitFor();
-//				regHog.join();
-//				installPath = regHog.getInstallPath();
-//			} catch (Exception rge) {
-//				Log.severe(RCoreMessages.error_failedToRunREG + rge);
-//				return false;
-//			}
-//			if (installPath == null) {
-//				Log.severe(RCoreMessages.error_youNeedRSoftware);
-//				return false;
-//			}
-//			// System.out.println(" Found R in : "+installPath +
-//			// "\\bin\\R.exe");
-//			return launchRserve(installPath + "\\bin\\R.exe", port, debug, rargs, rServeArgs); //$NON-NLS-1$
-//		}
-
+		// if (OSDetector.isFamilyWindows()) {
+		// // System.out.println("Windows: query registry to find where R is installed ...");
+		// String installPath = null;
+		// try {
+		// Process rp = Runtime.getRuntime().exec("reg query HKLM\\Software\\R-core\\R"); //$NON-NLS-1$
+		// StreamHog regHog = new StreamHog(rp.getInputStream(), true);
+		// rp.waitFor();
+		// regHog.join();
+		// installPath = regHog.getInstallPath();
+		// } catch (Exception rge) {
+		// Log.severe(RCoreMessages.error_failedToRunREG + rge);
+		// return false;
+		// }
+		// if (installPath == null) {
+		// Log.severe(RCoreMessages.error_youNeedRSoftware);
+		// return false;
+		// }
+		// // System.out.println(" Found R in : "+installPath +
+		// // "\\bin\\R.exe");
+		// return launchRserve(installPath + "\\bin\\R.exe", port, debug, rargs, rServeArgs); //$NON-NLS-1$
+		// }
+		
 		Log.fine(RCoreMessages.info_tryingToStartRWithRPath);
 		if (launchRserve("R", port, debug, rargs, rServeArgs)) { //$NON-NLS-1$
 			return true;
 		}
-
+		
 		// R not in the PATH env, try with R common installation paths
 		String[] paths = {
 				"/Library/Frameworks/R.framework/Resources/bin/R", //$NON-NLS-1$
@@ -237,7 +244,7 @@
 				"/sw/bin/R", //$NON-NLS-1$
 				"/usr/common/bin/R", //$NON-NLS-1$
 				"/opt/bin/R" }; //$NON-NLS-1$
-
+		
 		for (String path : paths) {
 			File execFile = new File(path);
 			Log.fine(RCoreMessages.bind(RCoreMessages.info_tryingToStartRFrom, path));
@@ -245,20 +252,20 @@
 				return true;
 			}
 		}
-
+		
 		return false;
-		//			
-		//		return (launchRserve("R", port, debug) //$NON-NLS-1$
-		//				|| /* try some common unix locations of R */
-		//				(( && launchRserve("/Library/Frameworks/R.framework/Resources/bin/R", port, debug)) //$NON-NLS-1$
-		//				|| ((new File("/usr/local/lib/R/bin/R")).exists() && launchRserve("/usr/local/lib/R/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
-		//				|| ((new File("/usr/lib/R/bin/R")).exists() && launchRserve("/usr/lib/R/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
-		//				|| ((new File("/usr/local/bin/R")).exists() && launchRserve("/usr/local/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
-		//				|| ((new File("/sw/bin/R")).exists() && launchRserve("/sw/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
-		//				|| ((new File("/usr/common/bin/R")).exists() && launchRserve("/usr/common/bin/R")) || ((new File( //$NON-NLS-1$ //$NON-NLS-2$
-		//				"/opt/bin/R")).exists() && launchRserve("/opt/bin/R"))); //$NON-NLS-1$ //$NON-NLS-2$
+		//
+		// return (launchRserve("R", port, debug) //$NON-NLS-1$
+		// || /* try some common unix locations of R */
+		// (( && launchRserve("/Library/Frameworks/R.framework/Resources/bin/R", port, debug)) //$NON-NLS-1$
+		// || ((new File("/usr/local/lib/R/bin/R")).exists() && launchRserve("/usr/local/lib/R/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		// || ((new File("/usr/lib/R/bin/R")).exists() && launchRserve("/usr/lib/R/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		// || ((new File("/usr/local/bin/R")).exists() && launchRserve("/usr/local/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		// || ((new File("/sw/bin/R")).exists() && launchRserve("/sw/bin/R")) //$NON-NLS-1$ //$NON-NLS-2$
+		// || ((new File("/usr/common/bin/R")).exists() && launchRserve("/usr/common/bin/R")) || ((new File( //$NON-NLS-1$ //$NON-NLS-2$
+		// "/opt/bin/R")).exists() && launchRserve("/opt/bin/R"))); //$NON-NLS-1$ //$NON-NLS-2$
 	}
-
+	
 	/**
 	 * check whether Rserve is currently running (on local machine and default
 	 * port).
@@ -272,14 +279,15 @@
 			// System.out.println("Rserve is running.");
 			// c.close();
 			return true;
-		} catch (Exception e) {
+		}
+		catch (Exception e) {
 			// System.out.println("First connect try failed with: "+
 			// e.getMessage());
 		}
 		return false;
 	}
-
-
+	
+	
 	public static void main(String[] args) {
 		System.out.println("result=" + checkLocalRserve(8212, false, "", ""));
 		try {
@@ -290,7 +298,8 @@
 			c.eval("2+2");
 			c.shutdown();
 			System.out.println("Done");
-		} catch (Exception x) {
+		}
+		catch (Exception x) {
 			x.printStackTrace();
 		}
 	}
