Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (122)

Sign In or Sign Up now to post a comment!
  • Can you do all of this on notepad? :P

  • @Chattyboy123 yes but you must make a compiler (you can do that in notepad to just save you'r compiler as .bat) and then save this code as .java, you can find a tutorial on how to do this on youtube! ;)

  • @MattiasRosendahl really? I saved it under .jar! O_O!

    

  • @MattiasRosendahl Could you send me a link to that?

  • @Chattyboy123 just search, i dont rly have much time lol. if u dont find it on youtube, try google :D

  • Why can't i play the music??

  • Yo lo hice en netbeans seguí los mismo pasos, y no me sale ningún error asta me sale el cuadro de "Click me" jejej pero no me SUENA!!! porque??

    ayuda!!!!!

  • There's a JMF (Java Media Framework) plug-in for MP3 support, but it doesn't support the more common formats floating around the net. Use JavaZoom.

  • That's an awesome cursor...

  • You dumbass. You can't use sun packages anymore.

    Broken ass Java bullsh8

  • @eschelar uhm. You do realize this video is from 2009. Who's the dumbass now?

  • motherfucking gross indian say what motherfucker java

  • your mouse icon is fucking annoying.

  • This will solve all your problems

    Enter my-app-throws-java-io-ioexcept­ion-could-not-create-audiodata­-object ... it will take you to a stackoverflow page

  • I got it to work but it wont place sound PS I am using a wav file

  • It says it cannot find the class FileInputStream

  • I have tried to play the sound (*.mp3)

    But I am getting exception error :

    java.io.IOException: could not create audio stream from input stream

    Please Reply...

  • im using the javac command and a simple text editor to write code, and this didnt help, any suggestions?

  • Cool but mine is not playing. I caught 2 exceptions. FileNotFound Exception that should print File not found in a box, then an IOException that prints Error 101 in a box.

    Well, everytime I clack a button, it prints the IOException ie "Error 101". What did I do wrong?

    and again, I already have a GUI with multiple buttons. I just added music on one of them. HELP!

  • Where do you find the folder that you projects and stuff r in tht you import the .wav file to?

  • @2good4youboi In your Eclipse, do this: Click on File -> Properties -> Resource. (Do not click on the arrow thing in front of resource. Just look at the right side, you will see "Location:" ). That's where it is.

  • Comment removed

  • Comment removed

  • I have a similar problem to some people. I am using Notepad++ and running the program on cmd Compiler. No errors, 7 warning so it can run, but when i do i can't hear any music. I am using an mp3 file, and i have tried to call the method in other methods and it doesn't work. Any help??????????????????????????­????

  • @FlyOfDarkness nvm, got it to work :D

  • Some people don't have Eclipse

  • I Got Exception "could not create audio stream from input stream"

  • i can ONLY make this on netbeans. eclipse says stuff about restriction and when i turned the errors into waring it still had two other errors! and on netbeans no audio plays

  • whats the compiler thingy ur using

  • @MrJohnboyofsj He's using Eclipse . . . that's the thingie me old cock sparrow!

  • i did exactly what he did and it doesnt work

    cant hear any sound

  • @marketanarchist2011 u might be using wrong type of sound file. You have to use a wav file for it to play + it has to be short or unconverted. I did the same way and it does not play long wavs, like normal 4mb tracks.

  • i finally followed schintus suggesting and got it to work but i have a problem ending the music file when it close

    it would just continue to play

    i had to eventually go to the window task manager and stop it

  • Comment removed

  • thank u brother...thanx a lot. have been searching this at breath's end.this was to the ultimate rescue.just showed 7warnings but worked absolutely fine.

  • HOW DO YOU CHAGNE THE VOLUME?!??!?!?

  • it said that i needed to do something with rt.jar

  • Hmm I'm not getting any music to play.. It's probably the way I've typed it though.

  • the program runs without errors or warnings but nothing is played.

  • did everything...but get 7 warnings..all saying like this :-

    sun.audio.AudioPlayer is Sun proprietary API and may be removed in a future release

    need help...

  • thank you ... ^_^

  • could you add a copy of the program in the comment section

  • This feels messy D:

  • My program builds but no music plays. I'm using a .wav file I followed all the steps. Sorry man but this didn't really help me. Guess I need to try again

  • @CoilMercurialFYZX I take it backkkkk IT WORKS!!!! YEEEEES!!!!! YOU ARE KIIIING!!!!!

  • @CoilMercurialFYZX How did you get it to work? It's not doing it for me...

  • doesn't work :O

  • Why the need for the sun* apis? Doesn't java have a standard sound api? The sun apis are not cross platform. They may not be there in every Java.

    Good vids though. ;)

  • tanks !!

  • I followed this thing completely, no compile error or anytihng, can't hear any sound anyways! Any that knows why possibly?

  • @rickardny Editted : Worked! Wrong format!

  • @rickardny turn ur volume up :)

  • Awesome tutorial BRO. It worked. Thanks.

  • nice tutorial...

  • does this work with JCreator?

  • can this be maked on netbeans ????????????????

  • @MrRafaStefan What ever Eclipse can make, NetBeans can make. NO EXCEPTIONS

  • @klglange ok ill test it now if can realy thanks ! :)

  • Doesn't work... maybe it's because I'm using mp3?

  • @12eebok You can simply convert it

  • @xxxcoolboyxxx It's fine, I installed the JLayer Jar which allows me to do exactly what I need -- without affecting the sound quality.

  • Thank you so much, this video was a BIG help. The only issue I had was I had to place "String[ ] args" in "public static void (String[ ] args)". Otherwise it worked very well. thanks

  • This doesnt work its telling me that im missing something to be able to use this..

    all the audio key words are red..

  • How would you stop the loop? i have tried MGP.stop(loop); but that doesnt work... when i run the program it just keeps running until i close out of eclipse.

    Thanks :)

  • I'm using Java Ready to Program and i can't get the file to play Some1 help please.

  • thanks a lot! i've been trying to find out how to playback audio for a while, and everything but this failed.

    thanks for ending my frustration and cursing :)

  • I use netbeans, can't play.

  • please teach me how to stop that audio, guys

  • please teach me how to stop that audio, guys

  • @LaCrusNguyen A little late now, but it is what he mentioned he forget... the close operator:

    object.setDefaultCloseOperatio­n(JFrame.Exit_ON_CLOSE);

    Now you can click the 'x' button and the program will exit.

  • thx :D

  • You rock, my teacher is expecting us to put sound clips to our latest program but the book only tells us how to put sound to applets. fail xD

  • damn your lips are kinda annoying -_-

    nyc vid anyway

  • im getting a error that says that audiostream and the other methods are not accesible due to the restriction on required library. Can anyone help?

  • @BlitzOp I have same problem

  • @mitchyc2012

    on the tool bar go to Windows -> Preferences -> Java -> Compiler -> Errors/Warnings. Change the forbidden references to "warning". This will allow it to run. For some reason I use pics or audio on my java.

  • @BlitzOp Remove the JRE System Library, then add it again. It worked for me.

  • thanks

  • convert your wav to au and it will work fine

  • it doesnt workkkkkk

  • this tutorial only works on specific wav files. it will not work on mp3, mp4 and it will not work on high quality wav files.

    if you want to make sure it works just try one of windows wav file

    if you want to use mp3's try jmf player

  • @malkisab For mp3's you could simply convert them in Audacity or some similar program.

  • hey i'am getting the error in this method( public static class Al implements ActionListener) its telling that its not override ABSTRACT METHOD,

    please help..

  • it shows d click me button but it doesnt play.. can someone help me pls...

  • could someone tell me where should i put my audio file if am writing the code without any IDE (i mean manual coding)

  • it does not work!

  • there was an error :could not create audio stream from an input stream

  • Comment removed

  • java.io.IOException: could not create audio stream from input stream

    

  • @TheYoosuf Any help on that error!!

  • Hi I've got it working but I cant get it to stop looping :(, please please please could you help i would appreciate it sooooo much :)

  • @doyoumind55

    would u please send me your code i wrote it all identical to Mrjavahelp help but all i got was access restriction errors

  • @deathinka do you mean warning messages? and what software are you using? warning messages are fine your program should still build fine

  • awesome tutorial dude

    but one quick question:

    if im using JCreator, and the program cant find the file, is it because:

    -The file is too big?

    -Its an mp3 file?

    -If i convert it to wav, would it work?

    thnx for the video :)

  • what's a good song for a puzzle game i'm making?

  • does java only support wav files?

  • i cannot use this in java 1.6 it says restricted access on audio player stream and data and that it will be removed in a future realease

  • Thank you! This tutorial was very helpful. Except, how do you make it so that it only plays the clip once and not as a loop.

  • scratch that, now I only have a problem with buttons 4-10 (i made a program with 10 buttons rather than 1)

    and I get errors on the button(#).addActionListner (action(#) ());

    saying that the action cannot be resolved as a type

    any help?

  • Not only will music not play on my first button, but for my second button I get this for the AudioData = MD;

    "The local variable MD is never read"

    Any help? thanks.

  • Access restriction: The type AudioData is not accessible due to restriction on required library C:\Program Files\Java\jre6\lib\rt.jar

    Why am I getting this error for everything involving AudioPlayer?

  • In eclipse do this: Window -> Preferences -> Java -> Compiler -> Errors/Warnings -> Deprecated and restricted API -> Forbidden reference (access rules) -> set it to 'Warnings'

  • @schintus Thanx ...it Worked :D

  • @schintus didn't work for me I am still getting a weird restriction error

  • Comment removed

  • Any one that knows how to stop the loop?

    i have tried

    AudioPlayer.player.stop (continuousaudiostream);

    but it wont stop =/

  • Very helpful thanks!

  • Great tutorial man, any one that uses netbeans?

    i put the mp3 file in the same folder as the main file but the mp3 file still cant be found

  • You can put the full path of the file instead of just putting the file name. That way the program will know exactly where to look. For example you can put "C:/Users/My Documents/Safari2.mp3" instead of putting the file name

  • Thanks man, ill try that :)

  • @joint08 You can put it outside the src folder.

  • I'm using netbeans.

  • Thanks for EXCELENT tutorials.

    A quick question(without trying).

    If U delete the file(safari2), how come the program still run? Must be a catch error(file not found).

  • I dont think a warning should matter to weather or not the program will work

  • awesome!

Loading...
Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more