Jump to content

Please, Need Steps to Run O'Reilly's QuickTime for Java Example Code

caradeoso123's Photo
Posted Jan 29 2011 01:55 PM
5593 Views

Mac OSX 10.6.4
Java 1.6.0
Terminal (bash)

Hi,

I haven't been able to run O'Reilly's QuickTime for Java example code. I bought the book, but the setup instructions are barely mentioned. It only mentions that I should use Apache Ant to build and run the example code.

I've gotten as far as building with Ant the "build.xml" file that comes inside the example code folder (downloaded from the O'Reilly QT for Java page), but I can't seem to be able to compile or run any of the examples using the Terminal or following the book's minimum/loose instructions.

Could someone please help? Thanks much in advance.

Mac user: michaelfaraday
Apache Ant download (unzipped folder name): apache_ant
O'Reilly's QuickTime for Java example code download (unzipped folder name): QTJ_Example_code


Placed the "apache_ant" folder here: "/michaelfaraday/"
Placed the "QTJ_Example_code" folder here: "/"
Path to the "QTJava.zip" file: /System/Library/Java/Extensions/QTJava.zip

Typed the following commands in the Terminal (bash) app:

Michael-Faradays-MacBook-Pro:~ michaelfaraday$ export ANT_HOME=/michaelfaraday/apache_ant
Michael-Faradays-MacBook-Pro:~ michaelfaraday$ export PATH=${PATH}:${ANT_HOME}/bin
Michael-Faradays-MacBook-Pro:~ michaelfaraday$ export JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Versions/1.6/Home

Then typed:

Michael-Faradays-MacBook-Pro:~ michaelfaraday$ cd /QTJ_Example_code
Michael-Faradays-MacBook-Pro:QTJ_Example_code michaelfaraday$ ant

Got this as the output:

Buildfile: build.xml

help:
[echo] Available targets:
[echo] ch0n -- compile source for chapter n (eg "ch01", "ch02", etc.)
[echo] all -- compile source for all chapters
[echo] ch0n.jar -- make a .jar file for chapter n
[echo] qtj-notebook.jar -- compile source for all chapters and make jar
[echo] all.jar -- synonym for qtj-notebook.jar
[echo] run-example -- compile and run "example"
[echo] help-names -- echo all example names for use with run-example
[echo] clean -- remove .class files
[echo] help -- this help message (default)
[echo]

BUILD SUCCESSFUL
Total time: 0 seconds
Michael-Faradays-MacBook-Pro:QTJ_Example_code michaelfaraday$

//////////////////////////////////////////////////////////////////////////////////

ERRORS that I get when following the book's instructions trying to compile and run its examples:

Michael-Faradays-MacBook-Pro:~ michaelfaraday$ javac -classpath /System/Library/Java/Extensions/QTJava.zip QTJ_Example_code/src/com/oreilly/qtnotebook/ch01/QTVersionCheck.java
javac: file not found: QTJ_Example_code/src/com/oreilly/qtnotebook/ch01/QTVersionCheck.java
Usage: javac <options> <source files>
use -help for a list of possible options
Michael-Faradays-MacBook-Pro:~ michaelfaraday$

/////////////////////////////////////////////////////////////////////////////////

Michael-Faradays-MacBook-Pro:~ michaelfaraday$ cd /QTJ_Example_code
Michael-Faradays-MacBook-Pro:QTJ_Example_code michaelfaraday$ ant run-ch01-qtversioncheck
Buildfile: build.xml

init:
[echo] qtjavazip.file = /System/Library/Java/Extensions/QTJava.zip

ch01:
[javac] Compiling 3 source files to /QTJ_Example_code/classes
[javac] Note: Some input files use or override a deprecated API.
[javac] Note: Recompile with -Xlint:deprecation for details.

run-ch01-qtversioncheck:
[java] java.lang.reflect.InvocationTargetException
[java] at java.awt.EventQueue.invokeAndWait(EventQueue.java:1033)
[java] at quicktime.QTSession.<clinit>(QTSession.java:94)
[java] at com.oreilly.qtjnotebook.ch01.QTVersionCheck.main(QTVersionCheck.java:34)
[java] Caused by: java.lang.UnsatisfiedLinkError: /System/Library/Java/Extensions/libQTJNative.jnilib: no suitable image found. Did find: /System/Library/Java/Extensions/libQTJNative.jnilib: no matching architecture in universal wrapper
[java] at java.lang.ClassLoader$NativeLibrary.load(Native Method)
[java] at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1861)
[java] at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1754)
[java] at java.lang.Runtime.loadLibrary0(Runtime.java:823)
[java] at java.lang.System.loadLibrary(System.java:1045)
[java] at quicktime.QTSession$1.run(QTSession.java:96)
[java] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
[java] at java.awt.EventQueue.dispatchEvent(EventQueue.java:633)
[java] at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:296)
[java] at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:211)
[java] at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:201)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:196)
[java] at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:188)
[java] at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
[java] Exception in thread "main" java.lang.UnsatisfiedLinkError: quicktime.QTSession.Gestalt(I[I)S
[java] at quicktime.QTSession.Gestalt(Native Method)
[java] at quicktime.QTSession.gestalt(QTSession.java:935)
[java] at quicktime.QTSession.open(QTSession.java:641)
[java] at quicktime.QTSession.open(QTSession.java:608)
[java] at com.oreilly.qtjnotebook.ch01.QTVersionCheck.main(QTVersionCheck.java:34)
[java] Java Result: 1

BUILD SUCCESSFUL
Total time: 3 seconds
Michael-Faradays-MacBook-Pro:QTJ_Example_code michaelfaraday$

Tags:
1 Subscribe


1 Reply

0
  macnlos's Photo
Posted Jan 31 2011 10:38 AM

Quote

Michael-Faradays-MacBook-Pro:~ michaelfaraday$ javac -classpath /System/Library/Java/Extensions/QTJava.zip QTJ_Example_code/src/com/oreilly/qtnotebook/ch01/QTVersionCheck.java
javac: file not found: QTJ_Example_code/src/com/oreilly/qtnotebook/ch01/QTVersionCheck.java


Your problem is in your command line. You have the following which is wrong: "javac -classpath /System/Library/Java/Extensions/QTJava.zip QTJ_Example_code/src/com/oreilly/qtnotebook/ch01/QTVersionCheck.java"

You are missing a "/" at the beginning of QTJ portion of your command. It should be as follows: "javac -classpath /System/Library/Java/Extensions/QTJava.zip /QTJ_Example_code/src/com/oreilly/qtnotebook/ch01/QTVersionCheck.java"

You have to fully qualify your paths. The only way your way would have worked would have been if you were currently in the "/" (root) directory. Because you were in your home direct "~" (/Users/michaelfaraday) it was trying to find a folder in that directory called "QTJ_Example_code" and it's not there, it's in the root directoy.

On a side note: DON'T put stuff in the "/" directory, that's just bad/messy form. Either put it in your home directory or the /tmp directory. This isn't a C drive.
=========================
Sent to you from my
iPad, iPhone, BlackBerry,
Laptop, Desktop, or
Kitchen Toaster