Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: HELP WITH THE ERROR.

  1. #1
    Junior Member
    Join Date
    Jan 2014
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Post HELP WITH THE ERROR.

    error.jpg

    package itproj;

    import java.awt.FlowLayout;
    import java.io.File;
    import javax.media.Format;
    import javax.media.Manager;
    import javax.media.MediaLocator;
    import javax.media.Player;
    import javax.media.PlugInManager;
    import javax.media.format.AudioFormat;
    import javax.swing.JApplet;
    import javax.swing.JLabel;

    /**
    *
    * @author karl
    */
    public class Sounds extends JApplet {

    JLabel TITLE = new JLabel("Mp3 player stand alone");

    /**
    *
    */
    @Override
    public void init() {
    setLayout(new FlowLayout());
    getContentPane().add(TITLE);

    Format input_mp3 = new AudioFormat(AudioFormat.MPEGLAYER3);
    Format input_mpeg = new AudioFormat(AudioFormat.MPEG);
    Format output = new AudioFormat(AudioFormat.LINEAR);

    PlugInManager.addPlugIn("com.sun.media.codec.audio .mp3.JavaDecoder",
    new Format[]{input_mp3,input_mpeg},
    new Format[]{(output)},PlugInManager.CODEC
    );

    try{
    String SubDirectory = "Music/";
    String FileName;
    FileName = "02-311-love_song-legacymp3.mp3";

    FileName = Get_File_Location(FileName, SubDirectory);
    System.out.println(FileName);

    Player PLAYER = Manager.createPlayer( new MediaLocator(
    new File(FileName).toURI().toURL() ) );

    PLAYER.start();



    }catch(Exception X){
    X.printStackTrace();

    }

    // TODO overwrite start(), stop() and destroy() methods
    }

    private String Get_File_Location(String FileName, String SubDirectory)
    {

    FileName = SubDirectory + FileName;
    FileName = this.getClass().getResource(FileName).toString();
    FileName = FileName.replace("/", "\\\\");
    FileName = FileName.substring(7);


    return FileName;

    }
    }


  2. #2
    Crazy Cat Lady KevinWorkman's Avatar
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    5,607
    My Mood
    Hungover
    Thanks
    145
    Thanked 658 Times in 563 Posts

    Default Re: HELP WITH THE ERROR.

    When posting code, please use the highlight tags to preserve formatting.

    What is the full text of your error? Copy and paste it in here directly instead of posting a screenshot.
    Useful links: How to Ask Questions the Smart Way | Use Code Tags | Java Tutorials
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

Similar Threads

  1. Replies: 3
    Last Post: November 30th, 2013, 05:52 PM
  2. Problems with A* Map Search - GC Overload Error and Null Error
    By puneeth.meruva in forum What's Wrong With My Code?
    Replies: 1
    Last Post: October 18th, 2013, 04:01 PM
  3. Replies: 4
    Last Post: October 15th, 2013, 05:33 AM
  4. Please! Help me to this error "ERROR CANNOT FIND SYMBOL"
    By mharck in forum Object Oriented Programming
    Replies: 8
    Last Post: July 3rd, 2012, 10:20 AM