From 892bb8534f077a548f73a6e3f393c54c1069dd9d Mon Sep 17 00:00:00 2001 From: benfry Date: Tue, 21 Oct 2008 00:23:30 +0000 Subject: [PATCH] read location of QTSystem from the registry to locate QTJava.zip, also show a warning re: bad QT installs when the error message shows up. --- app/src/processing/app/debug/Runner.java | 28 +++++++++++++----- app/src/processing/app/windows/Platform.java | 30 +++++++++++--------- 2 files changed, 38 insertions(+), 20 deletions(-) diff --git a/app/src/processing/app/debug/Runner.java b/app/src/processing/app/debug/Runner.java index 5ccd9168b..363f7313d 100644 --- a/app/src/processing/app/debug/Runner.java +++ b/app/src/processing/app/debug/Runner.java @@ -47,10 +47,10 @@ import com.sun.jdi.event.ExceptionEvent; public class Runner implements MessageConsumer { private boolean presenting; - - // Object that listens for error messages or exceptions. + + // Object that listens for error messages or exceptions. private RunnerListener listener; - + // Running remote VM private VirtualMachine vm; @@ -89,19 +89,19 @@ public class Runner implements MessageConsumer { // private MessageSiphon processError; - public Runner(Sketch sketch, String appletClassName, + public Runner(Sketch sketch, String appletClassName, boolean presenting, RunnerListener listener) { this.sketch = sketch; this.appletClassName = appletClassName; this.presenting = presenting; this.listener = listener; - + if (listener instanceof Editor) { this.editor = (Editor) listener; } } - + public void launch() { // TODO entire class is a total mess as of release 0136. // This will be cleaned up significantly over the next couple months. @@ -625,11 +625,25 @@ public class Runner implements MessageConsumer { } + boolean badQuickTimeWarning; + + // This may be called more than one time per error in the VM, + // presumably because exceptions might be wrapped inside others, + // and this will fire for both. protected void reportException(String message, ThreadReference thread) { try { int codeIndex = -1; int lineNumber = -1; + String badQuickTime = + "ClassNotFoundException: quicktime.std.StdQTException"; + if (message.equals(badQuickTime) && !badQuickTimeWarning) { + Base.showWarning("QuickTime not installed", + "Could not find a QuickTime installation.\n" + + "Please reinstall QuickTime 7 or later.", null); + badQuickTimeWarning = true; + } + // System.out.println("reporting ex"); List frames = thread.frames(); for (StackFrame frame : frames) { @@ -677,7 +691,7 @@ public class Runner implements MessageConsumer { return; } } catch (AbsentInformationException e) { - e.printStackTrace(); // do i really want to print a trace? + //e.printStackTrace(); // do i really want to print a trace? } } } catch (IncompatibleThreadStateException e) { diff --git a/app/src/processing/app/windows/Platform.java b/app/src/processing/app/windows/Platform.java index d545f6634..97e5ae93a 100644 --- a/app/src/processing/app/windows/Platform.java +++ b/app/src/processing/app/windows/Platform.java @@ -111,20 +111,24 @@ public class Platform extends processing.app.Platform { * Find QuickTime for Java installation. */ protected void checkQuickTime() { - String qtsystemPath = - Registry.getStringValue(REGISTRY_ROOT_KEY.LOCAL_MACHINE, - "Software\\Apple Computer, Inc.\\QuickTime", - "QTSysDir"); - if (qtsystemPath == null) { - System.err.println("QuickTime not installed"); - } else { - File qtjavaZip = new File(qtsystemPath, "QTJava.zip"); - if (qtjavaZip.exists()) { - String qtjavaZipPath = qtjavaZip.getAbsolutePath(); - String cp = System.getProperty("java.class.path"); - System.setProperty("java.class.path", - cp + File.pathSeparator + qtjavaZipPath); + try { + String qtsystemPath = + Registry.getStringValue(REGISTRY_ROOT_KEY.LOCAL_MACHINE, + "Software\\Apple Computer, Inc.\\QuickTime", + "QTSysDir"); + // Could show a warning message here if QT not installed, but that + // would annoy people who don't want anything to do with QuickTime. + if (qtsystemPath != null) { + File qtjavaZip = new File(qtsystemPath, "QTJava.zip"); + if (qtjavaZip.exists()) { + String qtjavaZipPath = qtjavaZip.getAbsolutePath(); + String cp = System.getProperty("java.class.path"); + System.setProperty("java.class.path", + cp + File.pathSeparator + qtjavaZipPath); + } } + } catch (UnsupportedEncodingException e) { + e.printStackTrace(); } }