diff --git a/platform/platform-impl/src/com/intellij/execution/process/RunnerMediator.java b/platform/platform-impl/src/com/intellij/execution/process/RunnerMediator.java index c192d78a28f9..bed914c41a74 100644 --- a/platform/platform-impl/src/com/intellij/execution/process/RunnerMediator.java +++ b/platform/platform-impl/src/com/intellij/execution/process/RunnerMediator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2015 JetBrains s.r.o. + * Copyright 2000-2017 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,7 +24,6 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; -import java.io.FileNotFoundException; import java.io.OutputStream; import java.io.PrintWriter; @@ -87,20 +86,22 @@ public class RunnerMediator { if (!SystemInfo.isWindows) { throw new IllegalStateException("There is no need of runner under unix based OS"); } - final String path = System.getenv(IDEA_RUNNERW); + + String path = System.getenv(IDEA_RUNNERW); if (path != null) { if (new File(path).exists()) { return path; } - LOG.warn("Cannot locate " + STANDARD_RUNNERW + " by " + IDEA_RUNNERW + " environment variable (" + path + ")"); + LOG.warn("Cannot locate " + STANDARD_RUNNERW + " by " + IDEA_RUNNERW + "=" + path); } - try { - return PathManager.findBinFileWithException(STANDARD_RUNNERW).getPath(); - } - catch (FileNotFoundException e) { - LOG.warn(e); - return null; + + File runnerw = PathManager.findBinFile(STANDARD_RUNNERW); + if (runnerw != null && runnerw.exists()) { + return runnerw.getPath(); } + + LOG.warn("Cannot locate " + STANDARD_RUNNERW + " in " + PathManager.getBinPath()); + return null; } static boolean injectRunnerCommand(@NotNull GeneralCommandLine commandLine) {