()
| 493 | protected void launchJava(final String[] args) { |
| 494 | new Thread(new Runnable() { |
| 495 | public void run() { |
| 496 | // PApplet.println("java starting"); |
| 497 | vmReturnedError = false; |
| 498 | process = PApplet.exec(args); |
| 499 | try { |
| 500 | // PApplet.println("java waiting"); |
| 501 | int result = process.waitFor(); |
| 502 | // PApplet.println("java done waiting"); |
| 503 | if (result != 0) { |
| 504 | String[] errorStrings = PApplet.loadStrings(process.getErrorStream()); |
| 505 | String[] inputStrings = PApplet.loadStrings(process.getInputStream()); |
| 506 | |
| 507 | // PApplet.println("launchJava stderr:"); |
| 508 | // PApplet.println(errorStrings); |
| 509 | // PApplet.println("launchJava stdout:"); |
| 510 | PApplet.printArray(inputStrings); |
| 511 | |
| 512 | if (errorStrings != null && errorStrings.length > 1) { |
| 513 | if (errorStrings[0].indexOf("Invalid maximum heap size") != -1) { |
| 514 | Messages.showWarning("Way Too High", |
| 515 | "Please lower the value for \u201Cmaximum available memory\u201D in the\n" + |
| 516 | "Preferences window. For more information, read Help \u2192 Troubleshooting.", null); |
| 517 | } else { |
| 518 | for (String err : errorStrings) { |
| 519 | sketchErr.println(err); |
| 520 | } |
| 521 | sketchErr.println("Using startup command: " + PApplet.join(args, " ")); |
| 522 | } |
| 523 | } else { |
| 524 | //exc.printStackTrace(); |
| 525 | sketchErr.println("Could not run the sketch (Target VM failed to initialize)."); |
| 526 | if (Preferences.getBoolean("run.options.memory")) { |
| 527 | // Only mention this if they've even altered the memory setup |
| 528 | sketchErr.println("Make sure that you haven't set the maximum available memory too high."); |
| 529 | } |
| 530 | sketchErr.println("For more information, read revisions.txt and Help \u2192 Troubleshooting."); |
| 531 | } |
| 532 | // changing this to separate editor and listener [091124] |
| 533 | //if (editor != null) { |
| 534 | listener.statusError("Could not run the sketch."); |
| 535 | vmReturnedError = true; |
| 536 | //} |
| 537 | // return null; |
| 538 | } |
| 539 | } catch (InterruptedException e) { |
| 540 | e.printStackTrace(); |
| 541 | } |
| 542 | } |
| 543 | }).start(); |
| 544 | } |
| 545 |
nothing calls this directly
no test coverage detected