• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Changing FilePath from full filepath to project folder filepath

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
this might be simple/ might not be simple

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.
 
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there, here the help I can offer



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 !

 
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

 
Frank Sween
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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



 
Marshal
Posts: 79151
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Frank Sween wrote:this might be simple/ might not be simple . . .

We like to reserve this forum for simple things, and I think this falls in the category of "might not be simple", so I shall move this thread.
 
reply
    Bookmark Topic Watch Topic
  • New Topic