Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Class not being called

Both the classes are in the same folder. But it was unable to call the class 'Player'. The player class contains latest media player that can even run video files from the network. Can u please help me out.

Here is the application.

import java.io.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import de.humatic.dsj.*;
public class Movie implements ActionListener
{
JButton b;
JPanel pane;
public Component createComp()
{
pane = new JPanel();
b = new JButton("Media Player");
pane.add(b);
b.addActionListener(this);
return pane;
}
public void actionPerformed(ActionEvent ae)
{
Player p = new Player();
}
public static void main(String agrs[])
{
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame frame = new JFrame("Media Player");
Movie m = new Movie();
Component comp = m.createComp();
frame.getContentPane().add(comp);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.pack();
frame.setSize(800,600);
frame.setVisible(true);
}
};

Here iam giving Player.java also

import java.io.*;
import de.humatic.dsj.*;
import javax.swing.*;
public class Player
{
public static void main(String args[])throws Exception
{
String path = "http://localhost:8080/seattle.wmv";
DSMovie ds = new DSMovie(path);
JFrame.setDefaultLookAndFeelDecorated(true);
JFrame f = new JFrame("Media Player");
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
f.getContentPane().add(ds);
f.pack();
f.setVisible(true);
}
};
[1724 byte] By [subhakar_nani] at [2007-11-11 7:56:20]
# 1 Re: Class not being called
Are they in the same package?
destin at 2007-11-11 22:36:55 >
# 2 Re: Class not being called
Yes ofcourse both the classes are in the same package.
subhakar_nani at 2007-11-11 22:38:00 >
# 3 Re: Class not being called
It's more complex than simply being in the same directory. Neither of these classes declare what package they are in. You should take a look at package declaration and classpath to make sure the JVM knows how to find the class you want.
Laszlo at 2007-11-11 22:38:59 >