MCPcopy Index your code
hub / github.com/benfry/processing4 / launchJava

Method launchJava

java/src/processing/mode/java/runner/Runner.java:523–572  ·  view source on GitHub ↗
(final String[] args)

Source from the content-addressed store, hash-verified

521
522
523 protected void launchJava(final String[] args) {
524 new Thread(() -> {
525// PApplet.println("java starting");
526 vmReturnedError = false;
527 process = PApplet.exec(args);
528 try {
529// PApplet.println("java waiting");
530 int result = process.waitFor();
531// PApplet.println("java done waiting");
532 if (result != 0) {
533 String[] errorStrings = PApplet.loadStrings(process.getErrorStream());
534 String[] inputStrings = PApplet.loadStrings(process.getInputStream());
535
536// PApplet.println("launchJava stderr:");
537// PApplet.println(errorStrings);
538// PApplet.println("launchJava stdout:");
539 PApplet.printArray(inputStrings);
540
541 if (errorStrings != null && errorStrings.length > 1) {
542 if (errorStrings[0].contains("Invalid maximum heap size")) {
543 Messages.showWarning("Way Too High",
544 "Please lower the value for \u201Cmaximum available memory\u201D in the\n" +
545 "Preferences window. For more information, read Help \u2192 Troubleshooting.", null);
546 } else {
547 for (String err : errorStrings) {
548 sketchErr.println(err);
549 }
550 sketchErr.println("Using startup command: " + PApplet.join(args, " "));
551 }
552 } else {
553 //exc.printStackTrace();
554 sketchErr.println("Could not run the sketch (Target VM failed to initialize).");
555 if (Preferences.getBoolean("run.options.memory")) {
556 // Only mention this if they've even altered the memory setup
557 sketchErr.println("Make sure that you haven't set the maximum available memory too high.");
558 }
559 sketchErr.println("For more information, read Help \u2192 Troubleshooting.");
560 }
561 // changing this to separate editor and listener [091124]
562 //if (editor != null) {
563 listener.statusError("Could not run the sketch.");
564 vmReturnedError = true;
565 //}
566// return null;
567 }
568 } catch (InterruptedException e) {
569 e.printStackTrace();
570 }
571 }).start();
572 }
573
574
575 /**

Callers 1

launchVirtualMachineMethod · 0.95

Calls 12

execMethod · 0.95
loadStringsMethod · 0.95
printArrayMethod · 0.95
showWarningMethod · 0.95
joinMethod · 0.95
getBooleanMethod · 0.95
waitForMethod · 0.80
statusErrorMethod · 0.65
startMethod · 0.45
containsMethod · 0.45
printlnMethod · 0.45
printStackTraceMethod · 0.45

Tested by

no test coverage detected