Jump to content

Please Help with Basic Setup for Using QuickTime for Java

caradeoso123's Photo
Posted Jan 27 2011 11:29 PM


I am not that new with Java programming, but I am new with dealing with third-party packages like the ones described in the setup included in O'Reilly's QuickTime for Java book, e.g., using Apache's Ant, or setting the classpath to the QTJava.zip file. I am also new with working with an IDE, e.g., Eclipse. I have only written code before using already included Java APIs, e.g., import java.io.*;. Plus until now, I had always used the Terminal in Mac OSX to compile and run programs.

Could anyone please help me out with these basic instructions to setup the classpath and the packages, so that I can actually focus on writing code? I apologize for my ignorance in regards to what I am assuming is considered general knowledge, but these things are my only problem; and they are only mentioned lightly in O'Reilly's book. On the other hand, I am actually pretty good at figuring out actual Java code.

A simple step-by-step example on how to setup Eclipse on Mac OSX 10.6.4, so that I could just make the following example code work, would go a long way for me.

I downloaded this code from O'Reilly's web page.
The "Code" folder includes:
graphics (folder)
src (folder)

package com.oreilly.qtjnotebook.ch01;

import quicktime.QTSession;
import quicktime.util.QTBuild;

public class QTVersionCheck {

public static void main (String[] args){
System.out.println("QT version: " +
QTSession.getMajorVersion() +
"." +
System.out.println("QT version: " +
QTBuild.getVersion() +
"." +
} catch (Exception e) {

Again, I am running Eclipse on Mac OSX 10.6.4

I have no problem understanding the Java code in the book, but I can't figure out how to go about to start using QTJ when I am told things like "build.xml is the build file for Ant."

I apologize for not being familiar with Ant, but all I want to do is to start writing Java code, and not be focusing on the Ant documentation. Again, a detailed step-by-step explanation on what exactly I have to do to start using the QuickTime for Java book would make this book worth it for me.

Thanks so much in advance,


1 Subscribe

2 Replies

+ 1
  macnlos's Photo
Posted Jan 28 2011 02:54 AM

When writing a java application you can either do it with an IDE (like Eclipse) or in a terminal with a text editor. The thing about using an IDE like Eclipse is that it handles a lot of things so you don't have to do it manually yourself. That is both good and bad. Good because it makes things a bit simpler and bad because you don't really learn what is going on. If this was me I would say stick with the command prompt, learn what it is you need to do, and once you understand the whole process then look toward an IDE to make things simpler.

From a Terminal or command prompt point of view here is what you should do:

Step 1: Navigate / change into the top level folder of the project. This is where the "build.xml" file is located.
Step 2: Display / echo out the CLASSPATH variable

Step 3: If the QTJava.zip file is not in the classpath then add/append it
export CLASSPATH=$CLASSPATH:<<path to your QTJava.zip file>>

Step 4: Build your java application with ANT

Step 5: Run your code with Java (this assumes class files are stored along with your java files)
java QTVersionCheck

Now, if you get a path error where Java cannot find QTVersionCheck then you need to add the location of that Class file to your CLASSPATH by appending it just like you did in Step #3.
Sent to you from my
iPad, iPhone, BlackBerry,
Laptop, Desktop, or
Kitchen Toaster
  caradeoso123's Photo
Posted Jan 28 2011 07:12 AM

Hey macnlos,

Thanks for the response, but I think your reply got cut off. I can't see anything beyond the line that says "From a Terminal or command prompt point of view here is what you should do:," and I have the threshold set to view all posts. Not sure if something was lost in the process. Could you please reply with what's missing from your post (the 'what you should do part' part)? Thanks so much.