This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
the assignment is to make an mp3 player with a folder full of mp3's that the player will be able to access and play mp3s from it. I have it working fine in that it gets the filepath of the mp3's and isable to play them just fine...
The problem I am envisioning is that the filepath that I have hardcoded into my code will only work from my computer, when I hand the project up TOMORROW , it will not work on my lecturers computer when he is marking it.
This filepath is my memory stick (Where I have eclipse installed) , its in 'MyTunes v2.1' project folder, 'myTune_v2_1' package,,, this is where the classes are and the 'mp3s' folder is in same place.
When I hand it up TOMORROW , the filepath will be wrong but I am handing up the whole project folder so I am hoping there is a way I can just put \\mp3s\\" +filePath); ,,, but I have tried this and it doesnt work.
Any help is greatly appreciated and a quick reply is even more so , as I have already said I have to hand this up in 12 hours time.
If you would like to really detect another USB drive, this solution might not suitable for you.
However, I encourage you to study the jdk api documentation, which is a place to get solution.
Moreover, 1 hour is enough for you to do a google search for a solution, be responsible for your project, cheers !
Here is the code that is used to find the path if the directory name is given.
But it will search all your entire drives for the folder which may take your entire life term.
I am sure this is not the efficient code.
But gives you some idea about java.io package.
Try modify this code as per your needs
SCJP 6,SCWCD 5,SCBCD 5
Failure is not an option.
Joined: Feb 19, 2009
you guys are great
im in a little over my head though i was hoping for a quick easy fix but now i see its not so simple to do in 5 hours ( i need sleep and ive been working different parts of this project since i last posted about 7 hours ago)
thanks anyway i will look into your solutions tomorow