@@ -53,7 +53,9 @@ protected Stage[] setStages() {
5353 JavaCompiler compiler = ToolProvider .getSystemJavaCompiler ();
5454 String javaHome = mcp .getOptions ().getStringParameter (TaskParameter .JAVA_HOME );
5555 if (javaHome .isEmpty () && compiler == null ) {
56- throw new RuntimeException ("Could not find compiling API. Please install or use a Java Development Kit to run this program." );
56+ RuntimeException t = new RuntimeException ("Could not find compiling API. Please install or use a Java Development Kit to run this program." );
57+ Util .throwExceptionInIDE (t );
58+ throw t ;
5759 }
5860 Path binPath = MCPPaths .get (mcp , BIN , side );
5961 Path srcPath = MCPPaths .get (mcp , SOURCE , side );
@@ -210,15 +212,19 @@ public void recompile(MCP mcp, Side side, String javaHome, Iterable<File> src, I
210212 boolean isWindows = OS .getOs ().equals (OS .windows );
211213 Path javac = Paths .get (javaHome ).resolve ("bin" ).resolve (isWindows ? "javac.exe" : "javac" );
212214 if (!Files .exists (javac )) {
213- throw new RuntimeException ("Failed to find javac at " + javac .toAbsolutePath ());
215+ RuntimeException t = new RuntimeException ("Failed to find javac at " + javac .toAbsolutePath ());
216+ Util .throwExceptionInIDE (t );
217+ throw t ;
214218 }
215219
216220 Path binDir = MCPPaths .get (mcp , BIN , side );
217221 if (!Files .exists (binDir )) {
218222 try {
219223 Files .createDirectories (binDir );
220224 } catch (IOException e ) {
221- throw new RuntimeException ("[" + side .getName () + "] Failed to create output directory for recompile!" );
225+ RuntimeException t = new RuntimeException ("[" + side .getName () + "] Failed to create output directory for recompile!" );
226+ Util .throwExceptionInIDE (t );
227+ throw t ;
222228 }
223229 }
224230
@@ -235,10 +241,14 @@ public void recompile(MCP mcp, Side side, String javaHome, Iterable<File> src, I
235241 try {
236242 int exitCode = Util .runCommand (cmd .toArray (new String []{}), MCPPaths .get (mcp , PROJECT , side ), true );
237243 if (exitCode != 0 ) {
238- throw new RuntimeException ("Failed to compile!" );
244+ RuntimeException t = new RuntimeException ("Failed to compile!" );
245+ Util .throwExceptionInIDE (t );
246+ throw t ;
239247 }
240248 } catch (IOException e ) {
241- throw new RuntimeException (e );
249+ RuntimeException t = new RuntimeException (e );
250+ Util .throwExceptionInIDE (t );
251+ throw t ;
242252 }
243253 }
244254}
0 commit comments