Quicktime installed?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Quicktime installed?

Sebastian B=?UTF-8?Q?=C3=B6ckmann?=
Hello,

In my java project I'm using quicktime (QTJava.jar) for video processing issues. So far so good, but to release my program I want to check if quicktime is installed properly. I use the following code:

try {
            QTSession.open();
        } catch (Exception e) {
            System.out.println("ERROR...");
            ...
        }

Unfortunately java does not show my error-message on a PC w/o quicktime installed. Instead I get the following error log:

Exception in thread "AWT-EventQueue-0" java.lang.Error: java.lang.reflect.InvocationTargetException
        at org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAction.java:859)
        at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:665)
        at org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:698)
        at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
        at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
        at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
        at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
        at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
        at java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
        at java.awt.Component.processMouseEvent(Component.java:6289)
        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
        at java.awt.Component.processEvent(Component.java:6054)
        at java.awt.Container.processEvent(Container.java:2041)
        at java.awt.Component.dispatchEventImpl(Component.java:4652)
        at java.awt.Container.dispatchEventImpl(Container.java:2099)
        at java.awt.Component.dispatchEvent(Component.java:4482)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
        at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
        at java.awt.Container.dispatchEventImpl(Container.java:2085)
        at java.awt.Window.dispatchEventImpl(Window.java:2478)
        at java.awt.Component.dispatchEvent(Component.java:4482)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
        at java.awt.EventQueue.access$000(EventQueue.java:85)
        at java.awt.EventQueue$1.run(EventQueue.java:603)
        at java.awt.EventQueue$1.run(EventQueue.java:601)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
        at java.awt.EventQueue$2.run(EventQueue.java:617)
        at java.awt.EventQueue$2.run(EventQueue.java:615)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:662)
        ... 40 more
Caused by: java.lang.UnsatisfiedLinkError: no QTJNative in java.library.path
        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
        at java.lang.System.loadLibrary(System.java:1028)
        at quicktime.QTSession.<clinit>(QTSession.java:89)
        at kickerspielanalyse.Kickerspielanalyse.ladeMov(Kickerspielanalyse.java:766)
        ... 45 more


Best regards
Sebastian Böckmann
Reply | Threaded
Open this post in threaded view
|

Re: Quicktime installed?

ctrueden
Hi Sebastian,

Did you try catching Throwable instead of just Exception?

-Curtis

On Mon, Feb 28, 2011 at 10:24 AM, Sebastian Böckmann <
[hidden email]> wrote:

> Hello,
>
> In my java project I'm using quicktime (QTJava.jar) for video processing
> issues. So far so good, but to release my program I want to check if
> quicktime is installed properly. I use the following code:
>
> try {
>            QTSession.open();
>        } catch (Exception e) {
>            System.out.println("ERROR...");
>            ...
>        }
>
> Unfortunately java does not show my error-message on a PC w/o quicktime
> installed. Instead I get the following error log:
>
> Exception in thread "AWT-EventQueue-0" java.lang.Error:
> java.lang.reflect.InvocationTargetException
>        at
> org.jdesktop.application.ApplicationAction.actionFailed(ApplicationAction.java:859)
>        at
> org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:665)
>        at
> org.jdesktop.application.ApplicationAction.actionPerformed(ApplicationAction.java:698)
>        at
> javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
>        at
> javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
>        at
> javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
>        at
> javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
>        at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
>        at
> javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:809)
>        at
> javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:850)
>        at
> java.awt.AWTEventMulticaster.mouseReleased(AWTEventMulticaster.java:272)
>        at java.awt.Component.processMouseEvent(Component.java:6289)
>        at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
>        at java.awt.Component.processEvent(Component.java:6054)
>        at java.awt.Container.processEvent(Container.java:2041)
>        at java.awt.Component.dispatchEventImpl(Component.java:4652)
>        at java.awt.Container.dispatchEventImpl(Container.java:2099)
>        at java.awt.Component.dispatchEvent(Component.java:4482)
>        at
> java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4577)
>        at
> java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
>        at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
>        at java.awt.Container.dispatchEventImpl(Container.java:2085)
>        at java.awt.Window.dispatchEventImpl(Window.java:2478)
>        at java.awt.Component.dispatchEvent(Component.java:4482)
>        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:644)
>        at java.awt.EventQueue.access$000(EventQueue.java:85)
>        at java.awt.EventQueue$1.run(EventQueue.java:603)
>        at java.awt.EventQueue$1.run(EventQueue.java:601)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
>        at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
>        at java.awt.EventQueue$2.run(EventQueue.java:617)
>        at java.awt.EventQueue$2.run(EventQueue.java:615)
>        at java.security.AccessController.doPrivileged(Native Method)
>        at
> java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
>        at java.awt.EventQueue.dispatchEvent(EventQueue.java:614)
>        at
> java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
>        at
> java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
>        at
> java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
>        at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
>        at
> java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
>        at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
> Caused by: java.lang.reflect.InvocationTargetException
>        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>        at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>        at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>        at java.lang.reflect.Method.invoke(Method.java:597)
>        at
> org.jdesktop.application.ApplicationAction.noProxyActionPerformed(ApplicationAction.java:662)
>        ... 40 more
> Caused by: java.lang.UnsatisfiedLinkError: no QTJNative in
> java.library.path
>        at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
>        at java.lang.Runtime.loadLibrary0(Runtime.java:823)
>        at java.lang.System.loadLibrary(System.java:1028)
>        at quicktime.QTSession.<clinit>(QTSession.java:89)
>        at
> kickerspielanalyse.Kickerspielanalyse.ladeMov(Kickerspielanalyse.java:766)
>        ... 45 more
>
>
> Best regards
> Sebastian Böckmann
>
Reply | Threaded
Open this post in threaded view
|

Re: Quicktime installed?

Burger Wilhelm
In reply to this post by Sebastian B=?UTF-8?Q?=C3=B6ckmann?=
Sebastian,

below is the plugin that I use for testing the QT installation. Perhaps it helps.

--Wilhelm
www.imagingbook.com


// --------------------------------------------------------------

import ij.IJ;
import ij.plugin.PlugIn;
import quicktime.QTException;
import quicktime.QTSession;
import quicktime.util.QTBuild;

public class QT_Test2 implements PlugIn {
   
        public void run(String arg) {
                IJ.log("Testing QuickTime installation:");
                boolean success = false;
                boolean hasQT = false;
        try {
            Class.forName("quicktime.QTSession");
            hasQT = true;
        }
        catch (Throwable throwable) {
        }
        if (!hasQT) {
        IJ.log("QuickTime not found.");
        return;
        }

        IJ.log("QuickTime is installed.");
                try {
                        QTSession.open();
                        success = true;
                } catch (QTException e) {
                }
                if (success && QTSession.isInitialized()) {
                        IJ.log("QuickTime initialized.");
                        IJ.log("QuickTime Version: " +
                                        QTSession.getMajorVersion() + "." +
                                        QTSession.getMinorVersion() + "." +
                                        QTSession.getBugFixVersion());
                        IJ.log("QuickTime for Java Version: " +
                                        QTBuild.getVersion() + "." +
                                        QTBuild.getSubVersion() + "." +
                                        QTBuild.getQualifyingSubVersion());
                        QTSession.close();
                        IJ.log("QuickTime seems to be working OK.");
                }
                else {
                        IJ.log("Could not initialize Quicktime!");
                }
        }
}

// --------------------------------------------------------------



> -----Original Message-----
> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
> Sebastian Böckmann
> Sent: Monday, February 28, 2011 5:24 PM
> To: [hidden email]
> Subject: Quicktime installed?
>
> Hello,
>
> In my java project I'm using quicktime (QTJava.jar) for video
> processing issues. So far so good, but to release my program I want to
> check if quicktime is installed properly. I use the following code:
>
> try {
>             QTSession.open();
>         } catch (Exception e) {
>             System.out.println("ERROR...");
>             ...
>         }
>
...
Reply | Threaded
Open this post in threaded view
|

Re: Quicktime installed?

Bill Mohler
Thanks for sharing this.  I was just coming upon a need for this test
myself.

Bill

On 3/1/11 3:12 AM, Burger Wilhelm wrote:

> Sebastian,
>
> below is the plugin that I use for testing the QT installation. Perhaps it helps.
>
> --Wilhelm
> www.imagingbook.com
>
>
> // --------------------------------------------------------------
>
> import ij.IJ;
> import ij.plugin.PlugIn;
> import quicktime.QTException;
> import quicktime.QTSession;
> import quicktime.util.QTBuild;
>
> public class QT_Test2 implements PlugIn {
>
> public void run(String arg) {
> IJ.log("Testing QuickTime installation:");
> boolean success = false;
> boolean hasQT = false;
>          try {
>              Class.forName("quicktime.QTSession");
>              hasQT = true;
>          }
>          catch (Throwable throwable) {
>          }
>          if (!hasQT) {
>           IJ.log("QuickTime not found.");
>           return;
>          }
>
>          IJ.log("QuickTime is installed.");
> try {
> QTSession.open();
> success = true;
> } catch (QTException e) {
> }
> if (success&&  QTSession.isInitialized()) {
> IJ.log("QuickTime initialized.");
> IJ.log("QuickTime Version: " +
> QTSession.getMajorVersion() + "." +
> QTSession.getMinorVersion() + "." +
> QTSession.getBugFixVersion());
> IJ.log("QuickTime for Java Version: " +
> QTBuild.getVersion() + "." +
> QTBuild.getSubVersion() + "." +
> QTBuild.getQualifyingSubVersion());
> QTSession.close();
> IJ.log("QuickTime seems to be working OK.");
> }
> else {
> IJ.log("Could not initialize Quicktime!");
> }
> }
> }
>
> // --------------------------------------------------------------
>
>
>
>> -----Original Message-----
>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>> Sebastian Böckmann
>> Sent: Monday, February 28, 2011 5:24 PM
>> To: [hidden email]
>> Subject: Quicktime installed?
>>
>> Hello,
>>
>> In my java project I'm using quicktime (QTJava.jar) for video
>> processing issues. So far so good, but to release my program I want to
>> check if quicktime is installed properly. I use the following code:
>>
>> try {
>>              QTSession.open();
>>          } catch (Exception e) {
>>              System.out.println("ERROR...");
>>              ...
>>          }
>>
> ...
Reply | Threaded
Open this post in threaded view
|

Re: Quicktime installed?

Bill Mohler
I'm using this slightly modified version of Wilhelm's class.  It worked
when I directly force hasQT to stay false in the code.  But when I leave
it with the option for hasQT to go true and I include in my project and
call it from a startup macro on a machine without QuickTime installed
(always Windows for this test), I still get an exception trace, which
I'm also pasting here below the code?   Shouldn't the catch (Throwable
throwable) be handling this exception?  Maybe I need to catch
QTException rather than Throwable?  Thanks for any advice!


import ij.IJ;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;
import quicktime.QTException;
import quicktime.QTSession;
import quicktime.util.QTBuild;

public class QT_Test2 {

     public static void run(String arg) {
         IJ.log("Testing QuickTime installation:");
         boolean success = false;
         boolean hasQT = false;
         try {
             Class.forName("quicktime.QTSession");
             hasQT = true;
         }
         catch (Throwable throwable) {
         }
         if (!hasQT ) {
             IJ.log("QuickTime not found.");
             GenericDialog gd = new GenericDialog("QuickTime not found");
             gd.addHelp("http://www.apple.com/quicktime/download/");
             gd.addMessage("Your computer does not have QuickTime
installed.  To fix this:\n\n" +
                     "1. Please click 'Install QuickTime' below to begin
QuickTime installation. \n\n" +
                     "2. Quit GLOWormJ and relaunch to view and analyze
GLOWorm movies.");
             gd.centerDialog(true);
             gd.setOKLabel("Quit GLOWormJ");
             gd.setHelpLabel("Install QuickTime");
             gd.showDialog();
             if (gd.wasOKed()) IJ.run("Quit");
             return;
         }

         IJ.log("QuickTime is installed.");
         try {
             QTSession.open();
             success = true;
         } catch (QTException e) {
         }
         if (success && QTSession.isInitialized()) {
             IJ.log("QuickTime initialized.");
             IJ.log("QuickTime Version: " +
                     QTSession.getMajorVersion() + "." +
                     QTSession.getMinorVersion() + "." +
                     QTSession.getBugFixVersion());
             IJ.log("QuickTime for Java Version: " +
                     QTBuild.getVersion() + "." +
                     QTBuild.getSubVersion() + "." +
                     QTBuild.getQualifyingSubVersion());
             QTSession.close();
             IJ.log("QuickTime seems to be working OK.");
         }
         else {
             IJ.log("Could not initialize Quicktime!");
         }
     }
}


java.lang.NoClassDefFoundError: quicktime/QTException
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
        at java.lang.Class.getMethod0(Unknown Source)
        at java.lang.Class.getMethod(Unknown Source)
        at ij.macro.Functions.call(Functions.java:3448)
        at ij.macro.Functions.getStringFunction(Functions.java:252)
        at ij.macro.Interpreter.getStringTerm(Interpreter.java:1161)
        at ij.macro.Interpreter.getString(Interpreter.java:1140)
        at ij.macro.Interpreter.doStatement(Interpreter.java:248)
        at ij.macro.Interpreter.doBlock(Interpreter.java:518)
        at ij.macro.Interpreter.runMacro(Interpreter.java:130)
        at ij.macro.MacroRunner.run(MacroRunner.java:126)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: quicktime.QTException
        at java.net.URLClassLoader$1.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(Unknown Source)
        at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 13 more





On 3/1/11 10:19 AM, Bill Mohler wrote:

> Thanks for sharing this.  I was just coming upon a need for this test
> myself.
>
> Bill
>
> On 3/1/11 3:12 AM, Burger Wilhelm wrote:
>> Sebastian,
>>
>> below is the plugin that I use for testing the QT installation. Perhaps it helps.
>>
>> --Wilhelm
>> www.imagingbook.com
>>
>>
>> // --------------------------------------------------------------
>>
>> import ij.IJ;
>> import ij.plugin.PlugIn;
>> import quicktime.QTException;
>> import quicktime.QTSession;
>> import quicktime.util.QTBuild;
>>
>> public class QT_Test2 implements PlugIn {
>>
>> public void run(String arg) {
>> IJ.log("Testing QuickTime installation:");
>> boolean success = false;
>> boolean hasQT = false;
>>           try {
>>               Class.forName("quicktime.QTSession");
>>               hasQT = true;
>>           }
>>           catch (Throwable throwable) {
>>           }
>>           if (!hasQT) {
>>           IJ.log("QuickTime not found.");
>>           return;
>>           }
>>
>>           IJ.log("QuickTime is installed.");
>> try {
>> QTSession.open();
>> success = true;
>> } catch (QTException e) {
>> }
>> if (success&&   QTSession.isInitialized()) {
>> IJ.log("QuickTime initialized.");
>> IJ.log("QuickTime Version: " +
>> QTSession.getMajorVersion() + "." +
>> QTSession.getMinorVersion() + "." +
>> QTSession.getBugFixVersion());
>> IJ.log("QuickTime for Java Version: " +
>> QTBuild.getVersion() + "." +
>> QTBuild.getSubVersion() + "." +
>> QTBuild.getQualifyingSubVersion());
>> QTSession.close();
>> IJ.log("QuickTime seems to be working OK.");
>> }
>> else {
>> IJ.log("Could not initialize Quicktime!");
>> }
>> }
>> }
>>
>> // --------------------------------------------------------------
>>
>>
>>
>>> -----Original Message-----
>>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>>> Sebastian Böckmann
>>> Sent: Monday, February 28, 2011 5:24 PM
>>> To: [hidden email]
>>> Subject: Quicktime installed?
>>>
>>> Hello,
>>>
>>> In my java project I'm using quicktime (QTJava.jar) for video
>>> processing issues. So far so good, but to release my program I want to
>>> check if quicktime is installed properly. I use the following code:
>>>
>>> try {
>>>               QTSession.open();
>>>           } catch (Exception e) {
>>>               System.out.println("ERROR...");
>>>               ...
>>>           }
>>>
>> ...
Reply | Threaded
Open this post in threaded view
|

Re: Quicktime installed?

ctrueden
Hi Bill,

Bio-Formats has a very functional QuickTime utility class for working with
QTJava:

http://trac.openmicroscopy.org.uk/ome/browser/bioformats.git/components/bio-formats/src/loci/formats/gui/LegacyQTTools.java

Perhaps it is sufficient for your needs?

It uses reflection extensively to avoid the types of problems you are
experiencing. It also looks for QTJava.zip in more locations, since on some
platforms QTJava may not be found be default, even if it is installed.

This code is currently licensed under GPL, but if all goes as planned should
be relicensed under BSD reasonably soon.

-Curtis

On Fri, Mar 4, 2011 at 11:24 AM, Bill Mohler <[hidden email]>wrote:

> I'm using this slightly modified version of Wilhelm's class.  It worked
> when I directly force hasQT to stay false in the code.  But when I leave it
> with the option for hasQT to go true and I include in my project and call it
> from a startup macro on a machine without QuickTime installed (always
> Windows for this test), I still get an exception trace, which I'm also
> pasting here below the code?   Shouldn't the catch (Throwable throwable) be
> handling this exception?  Maybe I need to catch QTException rather than
> Throwable?  Thanks for any advice!
>
>
> import ij.IJ;
> import ij.gui.GenericDialog;
>
> import ij.plugin.PlugIn;
> import quicktime.QTException;
> import quicktime.QTSession;
> import quicktime.util.QTBuild;
>
> public class QT_Test2 {
>
>    public static void run(String arg) {
>
>        IJ.log("Testing QuickTime installation:");
>        boolean success = false;
>        boolean hasQT = false;
>        try {
>            Class.forName("quicktime.QTSession");
>            hasQT = true;
>        }
>        catch (Throwable throwable) {
>        }
>        if (!hasQT ) {
>            IJ.log("QuickTime not found.");
>            GenericDialog gd = new GenericDialog("QuickTime not found");
>            gd.addHelp("http://www.apple.com/quicktime/download/");
>            gd.addMessage("Your computer does not have QuickTime installed.
>  To fix this:\n\n" +
>                    "1. Please click 'Install QuickTime' below to begin
> QuickTime installation. \n\n" +
>                    "2. Quit GLOWormJ and relaunch to view and analyze
> GLOWorm movies.");
>            gd.centerDialog(true);
>            gd.setOKLabel("Quit GLOWormJ");
>            gd.setHelpLabel("Install QuickTime");
>            gd.showDialog();
>            if (gd.wasOKed()) IJ.run("Quit");
>
>            return;
>        }
>
>        IJ.log("QuickTime is installed.");
>        try {
>            QTSession.open();
>            success = true;
>        } catch (QTException e) {
>        }
>        if (success && QTSession.isInitialized()) {
>            IJ.log("QuickTime initialized.");
>            IJ.log("QuickTime Version: " +
>                    QTSession.getMajorVersion() + "." +
>                    QTSession.getMinorVersion() + "." +
>                    QTSession.getBugFixVersion());
>            IJ.log("QuickTime for Java Version: " +
>                    QTBuild.getVersion() + "." +
>                    QTBuild.getSubVersion() + "." +
>                    QTBuild.getQualifyingSubVersion());
>            QTSession.close();
>            IJ.log("QuickTime seems to be working OK.");
>        }
>        else {
>            IJ.log("Could not initialize Quicktime!");
>        }
>    }
> }
>
>
> java.lang.NoClassDefFoundError: quicktime/QTException
>        at java.lang.Class.getDeclaredMethods0(Native Method)
>        at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
>        at java.lang.Class.getMethod0(Unknown Source)
>        at java.lang.Class.getMethod(Unknown Source)
>        at ij.macro.Functions.call(Functions.java:3448)
>        at ij.macro.Functions.getStringFunction(Functions.java:252)
>        at ij.macro.Interpreter.getStringTerm(Interpreter.java:1161)
>        at ij.macro.Interpreter.getString(Interpreter.java:1140)
>        at ij.macro.Interpreter.doStatement(Interpreter.java:248)
>        at ij.macro.Interpreter.doBlock(Interpreter.java:518)
>        at ij.macro.Interpreter.runMacro(Interpreter.java:130)
>        at ij.macro.MacroRunner.run(MacroRunner.java:126)
>        at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ClassNotFoundException: quicktime.QTException
>        at java.net.URLClassLoader$1.run(Unknown Source)
>
>        at java.security.AccessController.doPrivileged(Native Method)
>        at java.net.URLClassLoader.findClass(Unknown Source)
>        at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        at java.lang.ClassLoader.loadClass(Unknown Source)
>        ... 13 more
>
>
>
>
>
>
> On 3/1/11 10:19 AM, Bill Mohler wrote:
>
>> Thanks for sharing this.  I was just coming upon a need for this test
>> myself.
>>
>> Bill
>>
>> On 3/1/11 3:12 AM, Burger Wilhelm wrote:
>>
>>> Sebastian,
>>>
>>> below is the plugin that I use for testing the QT installation. Perhaps
>>> it helps.
>>>
>>> --Wilhelm
>>> www.imagingbook.com
>>>
>>>
>>> // --------------------------------------------------------------
>>>
>>> import ij.IJ;
>>> import ij.plugin.PlugIn;
>>> import quicktime.QTException;
>>> import quicktime.QTSession;
>>> import quicktime.util.QTBuild;
>>>
>>> public class QT_Test2 implements PlugIn {
>>>
>>>        public void run(String arg) {
>>>                IJ.log("Testing QuickTime installation:");
>>>                boolean success = false;
>>>                boolean hasQT = false;
>>>          try {
>>>              Class.forName("quicktime.QTSession");
>>>              hasQT = true;
>>>          }
>>>          catch (Throwable throwable) {
>>>          }
>>>          if (!hasQT) {
>>>                IJ.log("QuickTime not found.");
>>>                return;
>>>          }
>>>
>>>          IJ.log("QuickTime is installed.");
>>>                try {
>>>                        QTSession.open();
>>>                        success = true;
>>>                } catch (QTException e) {
>>>                }
>>>                if (success&&   QTSession.isInitialized()) {
>>>                        IJ.log("QuickTime initialized.");
>>>                        IJ.log("QuickTime Version: " +
>>>                                        QTSession.getMajorVersion() + "."
>>> +
>>>                                        QTSession.getMinorVersion() + "."
>>> +
>>>                                        QTSession.getBugFixVersion());
>>>                        IJ.log("QuickTime for Java Version: " +
>>>                                        QTBuild.getVersion() + "." +
>>>                                        QTBuild.getSubVersion() + "." +
>>>
>>>  QTBuild.getQualifyingSubVersion());
>>>                        QTSession.close();
>>>                        IJ.log("QuickTime seems to be working OK.");
>>>                }
>>>                else {
>>>                        IJ.log("Could not initialize Quicktime!");
>>>                }
>>>        }
>>> }
>>>
>>> // --------------------------------------------------------------
>>>
>>>
>>>
>>>  -----Original Message-----
>>>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>>>> Sebastian Böckmann
>>>> Sent: Monday, February 28, 2011 5:24 PM
>>>> To: [hidden email]
>>>> Subject: Quicktime installed?
>>>>
>>>> Hello,
>>>>
>>>> In my java project I'm using quicktime (QTJava.jar) for video
>>>> processing issues. So far so good, but to release my program I want to
>>>> check if quicktime is installed properly. I use the following code:
>>>>
>>>> try {
>>>>              QTSession.open();
>>>>          } catch (Exception e) {
>>>>              System.out.println("ERROR...");
>>>>              ...
>>>>          }
>>>>
>>>>  ...
>>>
>>
Reply | Threaded
Open this post in threaded view
|

Re: Quicktime installed?

Bill Mohler
In reply to this post by Bill Mohler
I think I found my problem below.  In short, if QTJava.zip is not in the
classpath on a client machine, then the classloader gags when reading in
this class because of the need to catch a QTException (for which no
class exists yet in the client JRE).  So I'm now running a different
shorter version of the class, leaving out the second try/catch block.  
It has the desired effect now, prompting the user to download and
install QuickTime if they want to continue.  Code is here:


import ij.IJ;
import ij.gui.GenericDialog;
import ij.plugin.PlugIn;
import quicktime.QTException;
import quicktime.QTSession;
import quicktime.util.QTBuild;

public class QT_Test2 {

     public static void run(String arg) {
         IJ.log("Testing QuickTime installation:");
         boolean success = false;
         boolean hasQT = false;
         try {
             Class.forName("quicktime.QTSession");
             hasQT = true;
         }
         catch (ClassNotFoundException cnfe) {
         }
         if (!hasQT ) {
             IJ.log("QuickTime not found.");
             GenericDialog gd = new GenericDialog("QuickTime not found");
             gd.addHelp("http://www.apple.com/quicktime/download/");
             gd.addMessage("Your computer does not have QuickTime
installed.  To fix this:\n\n" +
                     "1. Please click 'Install QuickTime' below to begin
QuickTime installation. \n\n" +
                     "2. Quit GLOWormJ and relaunch to view and analyze
GLOWorm movies.");
             gd.centerDialog(true);
             gd.setOKLabel("Quit GLOWormJ");
             gd.setHelpLabel("Install QuickTime");
             gd.showDialog();
             if (gd.wasOKed()) IJ.run("Quit");
             return;
         }

         IJ.log("QuickTime is installed.");

     }
}


On 3/4/11 12:24 PM, Bill Mohler wrote:

> I'm using this slightly modified version of Wilhelm's class.  It worked
> when I directly force hasQT to stay false in the code.  But when I leave
> it with the option for hasQT to go true and I include in my project and
> call it from a startup macro on a machine without QuickTime installed
> (always Windows for this test), I still get an exception trace, which
> I'm also pasting here below the code?   Shouldn't the catch (Throwable
> throwable) be handling this exception?  Maybe I need to catch
> QTException rather than Throwable?  Thanks for any advice!
>
>
> import ij.IJ;
> import ij.gui.GenericDialog;
> import ij.plugin.PlugIn;
> import quicktime.QTException;
> import quicktime.QTSession;
> import quicktime.util.QTBuild;
>
> public class QT_Test2 {
>
>       public static void run(String arg) {
>           IJ.log("Testing QuickTime installation:");
>           boolean success = false;
>           boolean hasQT = false;
>           try {
>               Class.forName("quicktime.QTSession");
>               hasQT = true;
>           }
>           catch (Throwable throwable) {
>           }
>           if (!hasQT ) {
>               IJ.log("QuickTime not found.");
>               GenericDialog gd = new GenericDialog("QuickTime not found");
>               gd.addHelp("http://www.apple.com/quicktime/download/");
>               gd.addMessage("Your computer does not have QuickTime
> installed.  To fix this:\n\n" +
>                       "1. Please click 'Install QuickTime' below to begin
> QuickTime installation. \n\n" +
>                       "2. Quit GLOWormJ and relaunch to view and analyze
> GLOWorm movies.");
>               gd.centerDialog(true);
>               gd.setOKLabel("Quit GLOWormJ");
>               gd.setHelpLabel("Install QuickTime");
>               gd.showDialog();
>               if (gd.wasOKed()) IJ.run("Quit");
>               return;
>           }
>
>           IJ.log("QuickTime is installed.");
>           try {
>               QTSession.open();
>               success = true;
>           } catch (QTException e) {
>           }
>           if (success&&  QTSession.isInitialized()) {
>               IJ.log("QuickTime initialized.");
>               IJ.log("QuickTime Version: " +
>                       QTSession.getMajorVersion() + "." +
>                       QTSession.getMinorVersion() + "." +
>                       QTSession.getBugFixVersion());
>               IJ.log("QuickTime for Java Version: " +
>                       QTBuild.getVersion() + "." +
>                       QTBuild.getSubVersion() + "." +
>                       QTBuild.getQualifyingSubVersion());
>               QTSession.close();
>               IJ.log("QuickTime seems to be working OK.");
>           }
>           else {
>               IJ.log("Could not initialize Quicktime!");
>           }
>       }
> }
>
>
> java.lang.NoClassDefFoundError: quicktime/QTException
> at java.lang.Class.getDeclaredMethods0(Native Method)
> at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
> at java.lang.Class.getMethod0(Unknown Source)
> at java.lang.Class.getMethod(Unknown Source)
> at ij.macro.Functions.call(Functions.java:3448)
> at ij.macro.Functions.getStringFunction(Functions.java:252)
> at ij.macro.Interpreter.getStringTerm(Interpreter.java:1161)
> at ij.macro.Interpreter.getString(Interpreter.java:1140)
> at ij.macro.Interpreter.doStatement(Interpreter.java:248)
> at ij.macro.Interpreter.doBlock(Interpreter.java:518)
> at ij.macro.Interpreter.runMacro(Interpreter.java:130)
> at ij.macro.MacroRunner.run(MacroRunner.java:126)
> at java.lang.Thread.run(Unknown Source)
> Caused by: java.lang.ClassNotFoundException: quicktime.QTException
> at java.net.URLClassLoader$1.run(Unknown Source)
> at java.security.AccessController.doPrivileged(Native Method)
> at java.net.URLClassLoader.findClass(Unknown Source)
> at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> at java.lang.ClassLoader.loadClass(Unknown Source)
> ... 13 more
>
>
>
>
>
> On 3/1/11 10:19 AM, Bill Mohler wrote:
>> Thanks for sharing this.  I was just coming upon a need for this test
>> myself.
>>
>> Bill
>>
>> On 3/1/11 3:12 AM, Burger Wilhelm wrote:
>>> Sebastian,
>>>
>>> below is the plugin that I use for testing the QT installation. Perhaps it helps.
>>>
>>> --Wilhelm
>>> www.imagingbook.com
>>>
>>>
>>> // --------------------------------------------------------------
>>>
>>> import ij.IJ;
>>> import ij.plugin.PlugIn;
>>> import quicktime.QTException;
>>> import quicktime.QTSession;
>>> import quicktime.util.QTBuild;
>>>
>>> public class QT_Test2 implements PlugIn {
>>>
>>> public void run(String arg) {
>>> IJ.log("Testing QuickTime installation:");
>>> boolean success = false;
>>> boolean hasQT = false;
>>>            try {
>>>                Class.forName("quicktime.QTSession");
>>>                hasQT = true;
>>>            }
>>>            catch (Throwable throwable) {
>>>            }
>>>            if (!hasQT) {
>>>             IJ.log("QuickTime not found.");
>>>             return;
>>>            }
>>>
>>>            IJ.log("QuickTime is installed.");
>>> try {
>>> QTSession.open();
>>> success = true;
>>> } catch (QTException e) {
>>> }
>>> if (success&&    QTSession.isInitialized()) {
>>> IJ.log("QuickTime initialized.");
>>> IJ.log("QuickTime Version: " +
>>> QTSession.getMajorVersion() + "." +
>>> QTSession.getMinorVersion() + "." +
>>> QTSession.getBugFixVersion());
>>> IJ.log("QuickTime for Java Version: " +
>>> QTBuild.getVersion() + "." +
>>> QTBuild.getSubVersion() + "." +
>>> QTBuild.getQualifyingSubVersion());
>>> QTSession.close();
>>> IJ.log("QuickTime seems to be working OK.");
>>> }
>>> else {
>>> IJ.log("Could not initialize Quicktime!");
>>> }
>>> }
>>> }
>>>
>>> // --------------------------------------------------------------
>>>
>>>
>>>
>>>> -----Original Message-----
>>>> From: ImageJ Interest Group [mailto:[hidden email]] On Behalf Of
>>>> Sebastian Böckmann
>>>> Sent: Monday, February 28, 2011 5:24 PM
>>>> To: [hidden email]
>>>> Subject: Quicktime installed?
>>>>
>>>> Hello,
>>>>
>>>> In my java project I'm using quicktime (QTJava.jar) for video
>>>> processing issues. So far so good, but to release my program I want to
>>>> check if quicktime is installed properly. I use the following code:
>>>>
>>>> try {
>>>>                QTSession.open();
>>>>            } catch (Exception e) {
>>>>                System.out.println("ERROR...");
>>>>                ...
>>>>            }
>>>>
>>> ...
Reply | Threaded
Open this post in threaded view
|

Re: Quicktime installed?

dscho
In reply to this post by Bill Mohler
Hi Bill,

On Fri, 4 Mar 2011, Bill Mohler wrote:

> I'm using this slightly modified version of Wilhelm's class.  It worked when
> the option for hasQT to go true and I include in my project and call it from
> a startup macro on a machine without QuickTime installed (always Windows for
> this test), I still get an exception trace, which I'm also pasting here below
> the code?   Shouldn't the catch (Throwable throwable) be handling this
> exception?  Maybe I need to catch QTException rather than Throwable?

To the contrary:

> [...]
>         try {
>             QTSession.open();
>             success = true;
>         } catch (QTException e) {
>         }

this is the problem: you are catching a QTException, but that class does
not exist in the classpath:

> [...]
> Caused by: java.lang.ClassNotFoundException: quicktime.QTException

Ciao,
Johannes