RemoteConnectionCreator (JavaParameters javaParameters) { return new RemoteConnectionCreator() { @Override public RemoteConnection createRemoteConnection(ExecutionEnvironment environment) { try { JavaParameters parameters = new JavaParameters(); parameters.setJdk(JavaParametersUtil.createProjectJdk(getProject(), myApplicationConfiguration.getAlternativeJrePath())); RemoteConnection connection = new RemoteConnectionBuilder(false, DebuggerSettings.getInstance().getTransport(), "") .asyncAgent(true) .project(environment.getProject()) .create(parameters); ParametersList programParametersList = javaParameters.getProgramParametersList(); String execArgsPrefix = "-Dexec.args="; int execArgsIndex = indexOf(programParametersList.getList(), s -> s.startsWith(execArgsPrefix)); String execArgsStr = programParametersList.get(execArgsIndex); ParametersList execArgs = new ParametersList(); execArgs.addAll(patchVmParameters(parameters.getVMParametersList())); execArgs.addParametersString(execArgsStr.substring(execArgsPrefix.length())); String classPath = toSystemDependentName(parameters.getClassPath().getPathsString()); execArgs.replaceOrPrepend("%classpath", "%classpath" + File.pathSeparator + classPath); programParametersList.set(execArgsIndex, execArgsPrefix + execArgs.getParametersString()); return connection; } catch (ExecutionException e) { throw new RuntimeException("Cannot create debug connection", e); } } @Override public boolean isPollConnection() { return true; } }; }