473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

JMF Applet problem

201 100+
Hi
I am working on JMF applets.

My problem is that the Applet runs successfully in the appletviewer.
But when i run it using any browser it shows Appled Loading Failed Error
In Firefox and Netscape ,

The Java Console shows following error

java.lang.NoClassDefFoundError: javax/media/ControllerListener

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknow n Source)

at sun.applet.AppletClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadCode(Unknown Source)

at sun.applet.AppletPanel.createApplet(Unknown Source)

at sun.plugin.AppletViewer.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

My ClassPath settings are
echo %CLASSPATH%
C:\Program Files\JMF2.1.1e\lib\jmf.jar;

I have copied and paste jmf.jar files in to run time environment
jar/lib/.
Sep 4 '07 #1
3 5181
r035198x
13,262 8TB
Hi
I am working on JMF applets.

My problem is that the Applet runs successfully in the appletviewer.
But when i run it using any browser it shows Appled Loading Failed Error
In Firefox and Netscape ,

The Java Console shows following error

java.lang.NoClassDefFoundError: javax/media/ControllerListener

at java.lang.ClassLoader.defineClass0(Native Method)

at java.lang.ClassLoader.defineClass(Unknown Source)

at java.security.SecureClassLoader.defineClass(Unknow n Source)

at sun.applet.AppletClassLoader.findClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadClass(Unknown Source)

at java.lang.ClassLoader.loadClass(Unknown Source)

at sun.applet.AppletClassLoader.loadCode(Unknown Source)

at sun.applet.AppletPanel.createApplet(Unknown Source)

at sun.plugin.AppletViewer.createApplet(Unknown Source)

at sun.applet.AppletPanel.runLoader(Unknown Source)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

My ClassPath settings are
echo %CLASSPATH%
C:\Program Files\JMF2.1.1e\lib\jmf.jar;

I have copied and paste jmf.jar files in to run time environment
jar/lib/.
Let's see your applet tags
Sep 4 '07 #2
praveen2gupta
201 100+
Hi
TypicalPlayerApplet.html

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head><meta http-equiv="content-type" content="text/html; charset=UTF-8">

<title> Video Mail Player</title>
</head>

<body>
<applet code="TypicalPlayerApplet" width=400 height=400>
<param name=file value="Video 4.avi">
</applet>


</html

TypicalPlayerApplet.java
import java.applet.Applet;
import java.awt.*;
import java.lang.String;
import java.net.URL;
import java.net.MalformedURLException;
import java.io.IOException;
import javax.media.*;

/**
<!-- Sample HTML

<applet code=TypicalPlayerApplet width=400 height=400>
<param name=File value="Video 4.avi">

* </applet>
* -->
*/

public class TypicalPlayerApplet extends Applet implements ControllerListener
{
// media player
Player player = null;


// component in which video is playing
Component visualComponent = null;
// controls gain, position, start, stop
Component controlComponent = null;
// displays progress during download
Component progressBar = null;


public void init()
{
// setLayout(new BorderLayout());
String mediaFile = null;

String url1= "http://localhost:8092";
// URL for doc containing applet

// Get the media filename info.
// The applet tag should contain the path to the
// source media file, relative to the html page.

if ((mediaFile = getParameter("FILE")) == null)
Fatal("Invalid media file parameter");

try
{
URL url= new URL(url1);
URL codeBase = getDocumentBase();

// Create an url from the file name and the url to the
// document containing this applet.

if ((url = new URL(codeBase, mediaFile)) == null)
Fatal("Can't build URL for " + mediaFile);

// Create an instance of a player for this media
if ((player = Manager.createPlayer(url)) == null)
Fatal("Could not create player for "+url);

// Add ourselves as a listener for player's events
player.addControllerListener(this);
}
catch (MalformedURLException u)
{
Fatal("Invalid media file URL!");
}


catch(IOException i)
{
Fatal("IO exception creating player for ");
}
catch(NoPlayerException j)
{
Fatal("IO exception creating player for ");
}

}


public void start()
{
// Call start() to prefetch and start the player.

if (player != null) player.start();
}


public void stop()
{
if (player != null)
{
player.stop();
player.deallocate();
}
}



public synchronized void controllerUpdate(ControllerEvent event)
{
// If we're getting messages from a dead player,


// just leave

if (player == null) return;

// When the player is Realized, get the visual
// and control components and add them to the Applet

if (event instanceof RealizeCompleteEvent)
{
if ((visualComponent = player.getVisualComponent()) != null)
add("Center", visualComponent);
if ((controlComponent = player.getControlPanelComponent()) != null)
add("South",controlComponent);
// force the applet to draw the components
validate();
}
else if (event instanceof CachingControlEvent)
{

// Put a progress bar up when downloading starts,
// take it down when downloading ends.

CachingControlEvent e = (CachingControlEvent) event;
CachingControl cc = e.getCachingControl();
long cc_progress = e.getContentProgress();
long cc_length = cc.getContentLength();

// Add the bar if not already there ...

if (progressBar == null)
if ((progressBar = cc.getProgressBarComponent()) != null)
{
add("North", progressBar);
validate();
}

// Remove bar when finished ownloading
if (progressBar != null)
if (cc_progress == cc_length)
{
remove (progressBar);
progressBar = null;
validate();
}
}
else if (event instanceof EndOfMediaEvent)
{


// We've reached the end of the media; rewind and
// start over

player.setMediaTime(new Time(0));
player.start();
}
else if (event instanceof ControllerErrorEvent)
{
// Tell TypicalPlayerApplet.start() to call it a day

player = null;
Fatal (((ControllerErrorEvent)event).getMessage());
}
}

void Fatal (String s)
{
// Applications will make various choices about what
// to do here. We print a message and then exit

System.err.println("FATAL ERROR: " + s);
throw new Error(s); // Invoke the uncaught exception
// handler System.exit() is another
// choice
}
}
Sep 4 '07 #3
praveen2gupta
201 100+
Hi
The problem is solved now. The applets do not access your classpath so the jmf.jar file is not access and applet shows the errors. To solve the problem define the copy and paste jmf.jar file in the currect folder and define it in archive tag of html file.
Sep 5 '07 #4

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

Similar topics

1
by: WMMorgan | last post by:
There's a website I like to visit that has an user-interactive java application. There's a "visual applet" component and "control applet" component. (No, it's not an adult or porno site.) But...
3
by: Jeff T. | last post by:
I have an applet that sizes itself to the size of the browser frame that it is running in. On IE the applet resizes upon dragging the frame divider. I'm having a problem with getting this...
1
by: Wayne's World | last post by:
hi everyone, i have a big problem, writing a image from my applet to my apache webserver. i tried three way's of writing that file. every way was described in forums to solve this problem, but...
5
by: Rowland | last post by:
Hi, I know this question has prob. been asked a million times, but I couldn't find it in the FAQ, so here goes : I'm trying to write a Java applet to call a dll that resides on the web server...
3
by: Larry Martin | last post by:
I am trying to run a Java Applet on my ascx page and am getting an IO exception when IE6 tries to load the applet. It seems a lot of others are getting the same problem but a search of the web did...
0
by: ankur | last post by:
WHEN I RUN THIS WEB APPLICATION ON Tomcat5.5.9 SERVER MY HttpChatApplet sccessfully Loaded from ChatDispatch but running on some another PC HttpChatApplet not loaded my Coad ...
0
by: shanmukhi | last post by:
Hi All I got a problem in running java programs. i am not able to run java applet while running i got a problem as Loading Java Applet Failed java.lang.NoClassDefFoundError: App (wrong...
0
by: shanmukhi | last post by:
Hi All I got a problem in running java Applet i am not able to run java applet while running i got a problem as Loading Java Applet Failed java.lang.NoClassDefFoundError: App (wrong name:...
1
by: sheephead86 | last post by:
Hi, I'm pretty new to java, and I have a small problem involving drawing a rectangle on a java applet.Firstly this is not a plea for someone to help me with this peice of work, I just need pointing...
2
by: pssraju | last post by:
Hi, I am having applet display problem on my PC and the same thing working fine on some of my colleagues PC's. When I cross checked content through view source its exactly same on both the PC's....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.