• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

NoClassDefFoundError: quicktime/QTSession

 
Michael Bunch
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anyone have an idea why the Java Plug-In cannot find the Quicktime classes. The applet compiles fine, but when I load the applet in a browser I get a java.lang.NoClassDefFoundError: quicktime/QTSession. I have my CLASSPATH set to C:\j2sdk1.4.0\classes;.;C:\Program Files\Java\j2re1.4.0\QTJava.zip . I even compiled the code with the target switch set to compile to java 1.1. Any ideas would help. Some feedback from someone who has worked with Quicktime for Java would be good to (what is the advantage of using it for images instead of java.awt.image)?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure that a Java 2 plug-in is being used by the browser? What happens when you use the AppletViewer?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, I'm not sure if the Java 2 plug-in allows use of a local classpath setting.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yep. After a little experimenting and research, I'm leaning towards believing that you aren't allowed to specify a classpath setting for Applets in the same manner that you are allowed to specify a classpath setting for Java Applications. I noticed one person mention that such a specification was allowed under Java 1.1.
It's a little inconvenient, but I think that it makes some sense also. I can imagine that security reasons would argue against such an ability. Also, why develop an Applet that no one else can use without downloading some package and setting their system's classpath setting to use the package?
You can still use another package. You'd just have to place it in a location relative to the Applet's codebase and reference it properly from within the code/class itself.
Does this make any sense yet?
 
Michael Bunch
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That explains alot. But since I am relatively new to java, I am only familiar with using the CLASSPATH setting. I have delt much more with application than with applets. What would be the alternative? If you could explain what I would need to do to get the applet to see this quicktime library, I would appreciate it. I will try anything at this point. Thanks alot.
 
Michael Bunch
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How would you reference it relative to the applet from within the class?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For example, let's create a quick applet that makes use of JavaRanch's common package.
Download JavaRanchCommon. To learn more about this package, head on over to http://www.javaranch.com/common.jsp .
Place this zip file in the same directory where you'll create a test applet. For the sake of this conversation, let's say the "Temp" directory of the "C" drive. Extract the contents of this zip file into the "C:\Temp" directory, preserving its internal directory structure (if you're using pkunzip, then use the -d switch - WinZip or a similar GUI will probably do this by default). Inside the "C:\Temp" directory should now be four new items: a directory named "com", a directory named "META-INF", a file named "LocalSystem.class", and a second file named "LocalSystem.java". Browse through these subdirectories just to see what's there. We'll make use of "com/javaranch/common/GDate.class". Note that we could make use of the "JavaRanchCommon.zip" file directly without unzipping it, but let's continue with this strategy and learn about the other later.
In the "C:\Temp" directory, create an html file called "TestApplet.html" with these contents:
Also create a Java source file called "TestApplet.java" in the "C:\Temp" directory with these contents:Compile "TestApplet.java" from the command line while working in the "C:\Temp" directory:
C:\Temp> javac TestApplet.java
That should have successfully created a class file named "TestApplet.class". Now use a browser to view the "C:\Temp\TestApplet.html" file. It should display today's date: 2002/6/27 .
Did that make sense?
 
Michael Bunch
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I applied your example to what I am trying to do and it is seeing and loading the classes, but I still get an error. It says java.lang.ExceptionInInitializerError Caused by: java.security.AccessControlException: access denied (java.lang.RuntimePermission loadLibrary.QTJava). Are there any permissions that I need to set. Everyone has full access on the directory with the classes in it. Should I check something else?
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What line of code creates that error?
 
Michael Bunch
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here is the code. As you can see, I am just trying to get it to work. If you see anything wrong, please let me know. Thanks alot.
import java.applet.Applet;
import java.awt.Font;
import java.awt.Graphics;
import quicktime.QTSession;
import quicktime.QTException;
public class OrderDetail extends Applet
{
public void init()
{
try
{
QTSession.open();
}
catch(Exception e)
{
QTSession.close();
e.printStackTrace();
}
}
public void paint(Graphics g)
{
g.setFont(new Font("Dialog", 1, 24));
g.drawString("Order Detail Applet", 55, 100);
}
}
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Michael,
Note that if you surround code with the [code] and [/code] UBB Tags, then most formatting is preserved and it makes it easier to read code posts.
I will guess that your exception is being generated when you open the QuickTime Session with QTSession.open(). The QTSession code must be trying to access resources on your system that an applet is not allowed to access.
I'm not familiar with this QuickTime package. Have you browsed its documentation? Perhaps something at their website is useful. I wouldn't be surprised if their package uses native code to improve performance. This might further complicate distribution of your Applet.
You may wish to sign your Applet, in order to allow it access to the user's system. Take a look at http://www.suitable.com/Doc_CodeSigning.shtml for a decent explanation on signing Applets for Internet Explorer and Netscape users (yes, each browser requires different strategies).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic