Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: New Java Breaking Stuff



On Nov 24, 2005, at 1:07 AM, email@hidden wrote:

I use code from Chis's Developers Notebook (the BasicQTEditor) and the Java upgrade for Tiger broke it.  What happens is, it opens properly but cannot open a video.

Executing the following from the book's "code" directory works fine for me:

[chrisg5:books/qtj developer's notebook/code] cadamson% /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java -classpath classes com.oreilly.qtjnotebook.ch02.BasicQTPlayer

Just to ack versions with you:

[chrisg5:books/qtj developer's notebook/code] cadamson% /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Commands/java -version                       java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-83)
Java HotSpot(TM) Client VM (build 1.5.0_05-48, mixed mode, sharing)

Note that if you use the ant tasks (like ant run-ch02-basicqtplayer), you'll pick up Java 1.4.2, not the new J2SE 5.0.

What's not working?  Do you get an error message?  Do you not get the file selector?  Do you get the selector but it won't play your video?  Have you tried other files (and/or, does the video you're trying to play work in QuickTime Player)?

System.setProperty("com.apple.eawt.CocoaComponent.CompatibilityMode", "false")

I tried this fix and am not clear on how to place it in the code (I'm pretty green).  If I drop it in before or after the main class declaration, I get an error ('class' or 'interface' expected).  Will this line fix the problem?  If yes, how specifically do I place it.  Will it need to be commented out if used on a Windows system?

Thanks for any help.

I don't believe that's necessary, since the book's code really does work in J2SE 5.0, but if you wanted to use the above system property, you'd want to set it as early as possible.  Two ways to do that:

1. Put it in a static initializer in the class with the main() method.  That will ensure it's run *before* main().  After your class declaration, and outside of any methods, do:
static {
System.setProperty (...);
}
2. Put it on the command line with a -D argument, like
java -Dcom.apple.eawt.CocoaComponent.CompatibilityMode=false

If it's in your code, Windows will ignore it, so you don't need to do anything special there.

--Chris

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
QuickTime-java mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/quicktime-java/email@hidden

This email sent to email@hidden

References: 
 >New Java Breaking Stuff (From: email@hidden)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.