Music, the beauty of life (well not really) has expressed a desire to enter into my program. I am going to have a song playing in the background for my program and my question is, how do I make it so it's not the direct address of the file? I managed to finally get it with images using this code:
So how do I have music work with the same simplified address location? I found a way to play my song in the prog in an example in my friends book so here's the code I used if it need's to be referenced to. Also, is there an easier way to make the music play in the background? I hate threads lol. Thanks for all help you guys can and do provide me with everytime i bother you.
I'm assuming that you want the following line to use a relative location. new File("c:/programming/Rpg/Ink_Spots-I_Don't_Want_To_Set_The_World_On_Fire.wav"); Note that a File object doesn't have to be constructed using an absolute file location. Working from my K:/java/temp directory, the following code snippet prints true.Placing the Foo.java file in a subdirectory named fubar, and changing the source code as follows also results in true. [ July 11, 2003: Message edited by: Dirk Schreckmann ]
Hmmm... as I can't seem to access my account Matt Fyffe right now (it no longer recognizes it :-\) I'll use this for now. I tried doing the same thing you did, however I got this message when I ran my program :-\. java.io.FileNotFoundException: Ink_Spots-I_Don't_Want_To_Set_The_World_On_Fire.wav (The system cannot find the file specified) If I offer the exact address it play's the song no problem at all. :-\/
Joined: Dec 10, 2001
Which line of code is causing the exception?
Joined: Jul 11, 2003
it doesn't say it when i compile, it compiles ok and runs fine but in a Terminal Window that comes up when I run my program says that message in it.