private static void appendParamsEncodingClasspath( SimpleJavaParameters javaParameters, GeneralCommandLine commandLine, ParametersList parametersList) { commandLine.addParameters(parametersList.getList()); appendEncoding(javaParameters, commandLine, parametersList); if (!parametersList.hasParameter("-classpath") && !parametersList.hasParameter("-cp") && !javaParameters.getClassPath().getPathList().isEmpty()) { commandLine.addParameter("-classpath"); commandLine.addParameter(javaParameters.getClassPath().getPathsString()); } }
private static void appendEncoding( SimpleJavaParameters javaParameters, GeneralCommandLine commandLine, ParametersList parametersList) { // Value of file.encoding and charset of GeneralCommandLine should be in sync in order process's // input and output be correctly handled. String encoding = parametersList.getPropertyValue("file.encoding"); if (encoding == null) { Charset charset = javaParameters.getCharset(); if (charset == null) charset = EncodingManager.getInstance().getDefaultCharset(); commandLine.addParameter("-Dfile.encoding=" + charset.name()); commandLine.withCharset(charset); } else { try { Charset charset = Charset.forName(encoding); commandLine.withCharset(charset); } catch (UnsupportedCharsetException ignore) { } catch (IllegalCharsetNameException ignore) { } } }
protected JavaParameters createJavaParameters() throws ExecutionException { log.debug("createJavaParameters"); SubstepsRunConfiguration runConfig = (SubstepsRunConfiguration) this.getEnvironment().getRunProfile(); SubstepsRunnerConfigurationModel model = runConfig.getModel(); JavaParameters params = model.getJavaParameters(); params.setWorkingDirectory(model.getWorkingDir()); if (params.getJdk() == null) { log.debug("params on the jdk is null"); params.setJdk( JavaSdkImpl.getInstance().createJdk(model.getVersionString(), model.getHomePath())); params.getClassPath().add(model.getClassPathString()); } params.getProgramParametersList().add("prog-args-env", "prg-localhost"); ParametersList vmParametersList = params.getVMParametersList(); vmParametersList.addParametersString("-Dfile.encoding=UTF-8"); vmParametersList.addParametersString("-Dcom.sun.management.jmxremote.port=" + jmxPort); vmParametersList.addParametersString("-Dcom.sun.management.jmxremote.authenticate=false"); vmParametersList.addParametersString("-Dcom.sun.management.jmxremote.ssl=false"); vmParametersList.addParametersString("-Djava.rmi.server.hostname=localhost"); // String rmiClasspathString = "\"file://" + // model.getClassPathString().replaceAll(File.pathSeparator, " file://") + "\""; // log.debug("rmi classpath: " + rmiClasspathString); // vmParametersList.addParametersString("-Djava.rmi.server.codebase=" + // rmiClasspathString); vmParametersList.addParametersString("-Dsun.io.serialization.extendedDebugInfo=true"); // System.setProperty("java.rmi.server.codebase", rmiClasspathString); // createServerSocket(params); // // // if (myServerSocket != null) { // params.getProgramParametersList().add(ForkedDebuggerHelper.DEBUG_SOCKET + // myServerSocket.getLocalPort()); // } // log.debug( "launching substeps runner with classpath: " + params.getClassPath().getPathsString() + "\njvm info: " + model.getHomePath() + " version: " + model.getVersionString()); return params; }