DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2006
    Posts
    17

    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);
    }
    };
    subhakar

  2. #2
    Join Date
    Dec 2005
    Location
    New Jersey
    Posts
    290
    Are they in the same package?

  3. #3
    Join Date
    Feb 2006
    Posts
    17
    Yes ofcourse both the classes are in the same package.
    subhakar

  4. #4
    Join Date
    Jan 2006
    Posts
    53
    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.

Similar Threads

  1. JDOM Classpath Help Required
    By kpandya in forum Java
    Replies: 5
    Last Post: 01-15-2006, 07:10 PM
  2. JDOM Errors & How to set the classpath
    By kpandya in forum Java
    Replies: 0
    Last Post: 01-14-2006, 07:01 PM
  3. Help with class/applet
    By none_none in forum Java
    Replies: 17
    Last Post: 04-28-2005, 03:00 PM
  4. Replies: 5
    Last Post: 10-17-2002, 01:58 PM
  5. Assembly class
    By Shailesh C.Rathod in forum .NET
    Replies: 2
    Last Post: 03-13-2002, 07:53 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links