use of com.intellij.execution.configurations.GeneralCommandLine in project intellij-community by JetBrains.
the class JdkUtil method setupJVMCommandLine.
public static GeneralCommandLine setupJVMCommandLine(@NotNull SimpleJavaParameters javaParameters) throws CantRunException {
Sdk jdk = javaParameters.getJdk();
if (jdk == null)
throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified"));
SdkTypeId type = jdk.getSdkType();
if (!(type instanceof JavaSdkType))
throw new CantRunException(ExecutionBundle.message("run.configuration.error.no.jdk.specified"));
String exePath = ((JavaSdkType) type).getVMExecutablePath(jdk);
if (exePath == null)
throw new CantRunException(ExecutionBundle.message("run.configuration.cannot.find.vm.executable"));
GeneralCommandLine commandLine = new GeneralCommandLine(exePath);
setupCommandLine(commandLine, javaParameters);
return commandLine;
}
use of com.intellij.execution.configurations.GeneralCommandLine in project intellij-community by JetBrains.
the class JdkUtil method setupJVMCommandLine.
/** @deprecated use {@link SimpleJavaParameters#toCommandLine()} (to be removed in IDEA 2018) */
public static GeneralCommandLine setupJVMCommandLine(final String exePath, final SimpleJavaParameters javaParameters, final boolean forceDynamicClasspath) {
try {
javaParameters.setUseDynamicClasspath(forceDynamicClasspath);
GeneralCommandLine commandLine = new GeneralCommandLine(exePath);
setupCommandLine(commandLine, javaParameters);
return commandLine;
} catch (CantRunException e) {
throw new RuntimeException(e);
}
}
use of com.intellij.execution.configurations.GeneralCommandLine in project intellij-community by JetBrains.
the class JdkPopupAction method retrieveJDKLocations.
private static ArrayList<Pair<File, String>> retrieveJDKLocations() {
ArrayList<Pair<File, String>> jdkLocations = new ArrayList<>();
Collection<String> homePaths = JavaSdk.getInstance().suggestHomePaths();
for (final String path : homePaths) {
try {
File file = new File(path);
File javaExe = new File(new File(file, "bin"), "java.exe");
ProcessOutput output = ExecUtil.execAndGetOutput(new GeneralCommandLine(javaExe.getAbsolutePath(), "-version"));
List<String> lines = output.getStderrLines();
if (lines.isEmpty()) {
lines = output.getStdoutLines();
}
StringBuilder stringBuilder = new StringBuilder();
if (lines.size() == 3) {
stringBuilder.append("JDK ");
String line = lines.get(1);
int pos = line.indexOf("(build ");
if (pos != -1) {
stringBuilder.append(line.substring(pos + 7, line.length() - 1));
}
line = lines.get(2);
pos = line.indexOf(" (build");
if (pos != -1) {
String substring = line.substring(0, pos);
stringBuilder.append(" (").append(substring).append(")");
}
} else {
stringBuilder.append(file.getName());
}
jdkLocations.add(Pair.create(file, stringBuilder.toString()));
} catch (ExecutionException e) {
LOG.debug(e);
}
}
return jdkLocations;
}
use of com.intellij.execution.configurations.GeneralCommandLine in project intellij-plugins by JetBrains.
the class PhoneGapCommandLine method serve.
private OSProcessHandler serve(String extraArg) throws ExecutionException {
GeneralCommandLine commandLine = new GeneralCommandLine(concat(newArrayList(myPath, "serve"), parseArgs(extraArg)));
commandLine.withWorkDirectory(myWorkDir);
return new KillableColoredProcessHandler(commandLine, true);
}
use of com.intellij.execution.configurations.GeneralCommandLine in project intellij-plugins by JetBrains.
the class PhoneGapCommandLine method createProcessHandler.
private OSProcessHandler createProcessHandler(String... commands) throws ExecutionException {
GeneralCommandLine commandLine = new GeneralCommandLine(commands);
commandLine.withWorkDirectory(myWorkDir);
return new KillableColoredProcessHandler(commandLine, true);
}
Aggregations