473,769 Members | 3,383 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

trouble with executing applets!!!! pl help

2 New Member
This is a code i wrote to play a video file usin JMF..... the applet gets started but not initialized.... . is the code correct or is there any mistake?????? please help me out as soon as u can......need to get this right as soon as i can.........

the input goes through the varialbles url and url2------ location of the file

this is the error i get
java.lang.NoCla ssDefFoundError : javax/media/ControllerListe ner
at java.lang.Class Loader.defineCl ass1(Native Method)
at java.lang.Class Loader.defineCl ass(ClassLoader .java:620)
at java.security.S ecureClassLoade r.defineClass(S ecureClassLoade r.java:12
4)
at sun.applet.Appl etClassLoader.f indClass(Applet ClassLoader.jav a:162)
at java.lang.Class Loader.loadClas s(ClassLoader.j ava:306)
at sun.applet.Appl etClassLoader.l oadClass(Applet ClassLoader.jav a:118)
at java.lang.Class Loader.loadClas s(ClassLoader.j ava:251)
at sun.applet.Appl etClassLoader.l oadCode(AppletC lassLoader.java :577)
at sun.applet.Appl etPanel.createA pplet(AppletPan el.java:710)
at sun.applet.Appl etPanel.runLoad er(AppletPanel. java:639)
at sun.applet.Appl etPanel.run(App letPanel.java:3 19)
at java.lang.Threa d.run(Thread.ja va:595)


Expand|Select|Wrap|Line Numbers
  1. import javax.swing.*;
  2. import javax.media.*;
  3. import java.awt.*;
  4. import javax.media.protocol.*;
  5. import java.net.*;
  6. import java.util.*;
  7. //import com.sun.media.util.JMFSecurity;
  8. /*
  9. <APPLET CODE = VideoApplet.class WIDTH = 442 HEIGHT = 317 >
  10. <PARAM NAME = CODE VALUE = VideoApplet.class >
  11. <PARAM NAME="type" VALUE="application/x-java-applet;version=1.1">
  12. <PARAM NAME = url VALUE ="FishTank.avi">
  13. <PARAM NAME = url2 VALUE ="FishTank2.avi">
  14. </APPLET>
  15. */
  16. public class VideoApplet extends JApplet implements ControllerListener
  17. {
  18.    // component in which video is playing
  19.     Component visualComponent = null;
  20.     // controls gain, position, start, stop
  21.     Component controlComponent = null;
  22.     // displays progress during download
  23.     Component progressBar = null;
  24.     boolean firstTime = true;
  25.     long CachingSize = 0L;    
  26.         int controlPanelHeight = 0;
  27.     int videoWidth = 0;
  28.     int videoHeight = 0;
  29.     String url;
  30.     MediaLocator locator;
  31.     Player player;
  32.     boolean f=false;
  33.     JPanel panel= new JPanel();
  34.     HashMap urlmap=new HashMap();
  35.     int loopcnt,looptot;
  36. public void init(){
  37.  
  38. looptot=0;
  39. String urls=getParameter("url");
  40. if(urls!=null){
  41.     if(urls.indexOf(",")!=-1){
  42.         StringTokenizer tokens=new StringTokenizer(urls,",");
  43.         while(tokens.hasMoreTokens()){
  44.             String url=tokens.nextToken();
  45.             looptot++;
  46.             System.out.println(" values : "+url+"  : "+looptot);
  47.             urlmap.put(String.valueOf(looptot),url);
  48.         }
  49.     }
  50.     else{
  51.         looptot=1;    
  52.         urlmap.put(String.valueOf(1),urls);
  53.     }
  54. }    
  55.         loopcnt=0;
  56.  
  57.         init2();
  58.     }
  59. public void init2(){
  60. if(looptot<=0)
  61.     return;
  62. loopcnt++;
  63. if(loopcnt>looptot)
  64.     loopcnt=1;
  65.     try {
  66.                url=(String)urlmap.get(String.valueOf(loopcnt));
  67.                URL url2 = new URL(url);
  68.         url = url2.toExternalForm();
  69.         System.out.println(" urlss :: "+url);
  70.             locator = new MediaLocator(url);
  71.             player = Manager.createRealizedPlayer(locator);    
  72.             player.addControllerListener(this);
  73.             panel.add(player.getVisualComponent());
  74.             panel.add(player.getControlPanelComponent());
  75.             getContentPane().add(panel);
  76.             //getContentPane().validate();
  77.             player.start();
  78.         } catch (Exception e) {
  79.             System.out.println("ERROR CREATING MEDIALOCATOR"+e);
  80.             System.exit(-1);
  81.         }
  82.     }
  83.       public void start() {
  84.  System.out.println("Applet.start()11 is called");
  85.         // Call start() to prefetch and start the player.
  86.         if (player != null)
  87.         player.start();
  88.     }
  89.     /**
  90.      * Stop media file playback and release resource before
  91.      * leaving the page.
  92.      */
  93.     public void stop() {
  94.      System.out.println("Applet.stop() is called");
  95.         if (player != null) {
  96.             player.stop();
  97.             player.deallocate();
  98.         }
  99.     }
  100.     public void destroy() {
  101.      System.out.println("Applet.destroy() is called");
  102.     player.close();
  103.     }
  104.       public synchronized void controllerUpdate(ControllerEvent event) {
  105.         System.out.println("Event called");
  106.     // If we're getting messages from a dead player, 
  107.     // just leave
  108.     if (player == null)
  109.         return;
  110.  
  111. if (event instanceof EndOfMediaEvent) {
  112. stop();
  113. destroy();
  114.  
  115.     //getContentPane().removeAll();
  116.     System.out.println("dfdsaf1");
  117.     panel.removeAll();
  118.     //panel.setVisible(false);
  119.     System.out.println("test2");
  120.     init2();
  121.     getContentPane().validate();
  122.     System.out.println("test3");
  123.     //getContentPane().removeAll();
  124. System.out.println("EndOfMediaEvent5  called");
  125. }
  126.  
  127.  
  128.     // When the player is Realized, get the visual 
  129.     // and control components and add them to the Applet
  130.     /*if (event instanceof RealizeCompleteEvent) {
  131.         if (progressBar != null) {
  132.         panel.remove(progressBar);
  133.         progressBar = null;
  134.         }
  135.  
  136.         int width = getWidth();//520;
  137.         int height = 0;
  138.         if (controlComponent == null)
  139.         if (( controlComponent = 
  140.               player.getControlPanelComponent()) != null) {
  141.  
  142.             controlPanelHeight = controlComponent.getPreferredSize().height;
  143.             panel.add(controlComponent);
  144.             height += controlPanelHeight;
  145.         }
  146.         if (visualComponent == null)
  147.         if (( visualComponent =
  148.               player.getVisualComponent())!= null) {
  149.             panel.add(visualComponent);
  150.             Dimension videoSize = visualComponent.getPreferredSize();
  151.             videoWidth = videoSize.width;
  152.             videoHeight = videoSize.height;
  153.             width = videoWidth;
  154.             height += videoHeight;
  155.             visualComponent.setBounds(0, 0, videoWidth, videoHeight);
  156.         }
  157.  
  158.         panel.setBounds(0, 0, width, height);
  159.         if (controlComponent != null) {
  160.         controlComponent.setBounds(0, videoHeight,
  161.                        width, controlPanelHeight);
  162.         controlComponent.invalidate();
  163.         }
  164.         //player.start();
  165.  
  166.      } else if (event instanceof CachingControlEvent) {
  167.         if (player.getState() > Controller.Realizing)
  168.         return;
  169.         // Put a progress bar up when downloading starts, 
  170.         // take it down when downloading ends.
  171.         CachingControlEvent e = (CachingControlEvent) event;
  172.         CachingControl cc = e.getCachingControl();
  173.  
  174.         // Add the bar if not already there ...
  175.         if (progressBar == null) {
  176.             if ((progressBar = cc.getControlComponent()) != null) {
  177.             panel.add(progressBar);
  178.             panel.setSize(progressBar.getPreferredSize());
  179.             validate();
  180.         }
  181.         }
  182.     } else if (event instanceof EndOfMediaEvent) {
  183.  
  184.  
  185.     System.out.println("Applet.EndOfMediaEvent4() called");
  186.         ///////////////////////////
  187.  
  188.  
  189.     } else if (event instanceof ControllerErrorEvent) {
  190.         // Tell TypicalPlayerApplet.start() to call it a day
  191.         System.out.println("Applet errorevent");
  192.         player = null;
  193.         Fatal(((ControllerErrorEvent)event).getMessage());
  194.         } else if (event instanceof ControllerClosedEvent) {
  195.         panel.removeAll();
  196.     }*/
  197.  
  198.  
  199.     }
  200.  
  201.     void Fatal (String s) {
  202.     // Applications will make various choices about what
  203.     // to do here. We print a message
  204.     System.err.println("FATAL ERROR: " + s);
  205.     throw new Error(s); // Invoke the uncaught exception
  206.                 // handler System.exit() is another
  207.                 // choice.
  208.  
  209.     }
  210. }
  211.  
Jan 30 '08 #1
3 1484
BigDaddyLH
1,216 Recognized Expert Top Contributor
It seems the java plugin doesn't have access to package javax.media. That's not part of the J2SE, right? How do you expect a client machine to access this package?
Jan 30 '08 #2
prashfire2000
2 New Member
It seems the java plugin doesn't have access to package javax.media. That's not part of the J2SE, right? How do you expect a client machine to access this package?
i've installed JMF... the code i downloaded from ine internet works...... but not mine..... i wanna make mine work....
Jan 30 '08 #3
BigDaddyLH
1,216 Recognized Expert Top Contributor
i've installed JMF... the code i downloaded from ine internet works...... but not mine..... i wanna make mine work....
The problems are arising because you are writing an applet. Why not write your example as a standalone application?
Jan 30 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2890
by: Fork | last post by:
Hi, I am trying to execute a script from the command line as follows; c:\program files\mysql\bin>mysql -u root newsman < servers3.mysql But this gives me the following error; ERROR 1064 at line 3: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax
4
1374
by: zmcelrath87 | last post by:
I am having a problem involving the scope of timeouts and intervals. Since timeouts and intervals execute in the global scope, dynamically generated local interval/timeout declarations do not work, because the dynamically generated code they have to execute involves variables that have been thrown out by the time of execution. In the first of the two following code examples, my interval declaration includes code that relies on variables...
9
5181
by: Don | last post by:
I'm trying to run the following page on my desktop from my host server. It works just fine if I run it from my desktop, but not if I run it from the server. I get "Error: Permission denied" on the "newActiveXObject" statement. I understand about the security issues surrounding ActiveX, but since I'm not accessinig any client-side files, I would think this should work. Any ideas would be appreciated. Thanks, Don
1
1353
by: Alvo von Cossel I | last post by:
yo dudes, i have a form with a helpbox in the controlbox. normally when you click the helpbox the cursor changes to a question mark and when you click somerthing, a help tooltip comes up. how do i make that tooltip? i know how to make standard tooltips but how do i make it appear when the helpbox is clicked? i do hope you get what i mean! if what i want is impossible, is there a way to make something else happen
0
1074
by: dba123 | last post by:
I have read and tried stuff in the following articles: http://support.microsoft.com/kb/896054/ http://www.interaktonline.com/Support/Knowledgebase/Technote/Details/60/116/Can't+open+CHM+file%252F+CHM+topics+are+blank.html I still get a page not found when clicking through various topics in the ..chm file. The page not found is pointing to res://C:\WINDOWS\system32\shdoclc.dll/dnserror.htm#mk:@MSITStore:\\ourservernamehere -- dba123
2
2326
by: vvenk | last post by:
Hello: I wrote a test procedure on Oracle that returns a string and a value. CREATE OR REPLACE PROCEDURE EBMS.p_CSV_Upload ( P_ERROR OUT VARCHAR2, P_ERROR_NO OUT Number ) AS
8
2009
by: Daz | last post by:
Hi everyone. I was faced with the choice of whether my problem is indeed a PHP problem or a MySQL. I have decided it's a PHP problem as I don't experience the same problem when I execute the same query at the CLI. I am having trouble executing a large query through my PHP script. It takes about 7-11 seconds on average to execute, whereas the same query only takes 0.01 seconds to execute through the CLI.
1
6185
by: Jeff | last post by:
ASP.NET 2.0 This stored procedure fails because the variable type contains a number. I've debugged the SP in VS2005 and it works if I change the 0/1 value of type to true/false... How should I fix this?? I cannot just replace type with the phrase "false" or "true"... maybe using SqlDbType.Bit is wrong This is header of this SP: ALTER PROCEDURE dbo.DeleteMessage @id uniqueidentifier, @user int, @type bit
7
6732
by: RawMustard | last post by:
Hi Folks, my first post here. Sorry to start with a request. I'm having trouble executing python scripts compiled to byte code on ubuntu feisty server version. Basically I can type ./MyScript.py and the script runs fine but if I compile the script and type ./MyScript.pyc it won't run, I just get some junk characters printed to my terminal that mean nothing. Now if I type python MyScript.pyc it runs fine. I guess it's a path thing, but...
0
9586
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10043
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9990
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8869
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
3956
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2814
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.