View Full Version : java search

16th October 2007, 04:22 PM
Hi guys

I am building a MP3 Player using java, now I want to be able to run through a directory and add all the songs from that directory to an array. by that I men the full location such as


However I want to stop it from adding any files that are not MP3

Is there a way I can search for particular files using java and then copy their corresponding URL ? i want this to work in windows as well.

16th October 2007, 09:43 PM
Are you wanting to use a gui file selector in this program. If you don't need one of those, just put the list of files in the directory in a list, loop through it and pull out those ending in mp3. http://www.exampledepot.com/egs/java.io/GetFiles.html

17th October 2007, 12:11 AM
I remember a code on demo directory (SwingSet or SwingSet2) that does what you want. See the source code. I know you can assign a filter but my memory is not as good as I want :).

You can in other way, put in a Vector, all entries in a directory and filter it.