Question

I am creating a program to play music from a user's computer based on an iTunes playlist file. When I try opening the audio file based on the location provided in the playlist text file, it says there is an error.

filename = "Macintosh HD/Users/mporter/Music/iTunes/iTunes Music/Music/Martin Garrix/Unknown Album/01 Animals (Original Mix).mp3"
FileInputStream fis = new FileInputStream(filename);
BufferedInputStream bis = new BufferedInputStream(fis);
player = new Player(bis);

When I do this, I get a java.io.FileNotFoundException: /Macintosh HD/Users/mporter/Music/iTunes/iTunes Music/Music/Martin Garrix/Unknown Album/01 Animals (Original Mix).mp3 (No such file or directory) error.

Would it have to do with the Macintosh HD/Users/ part? Or should I not be using FileInputStream?

Not sure if it matters here but I am using the jl1.0.1.jar external Library.

Thanks! :D

Was it helpful?

Solution

Your issue is coming from the path given to the class. It seems like you're on Mac, so an absolute path should begin with a '/', not with the name of a drive.

You should probably give to the class something like /Macintosh HD/Users/..., or maybe something else if "Macintosh HD" is a drive mounted in a special folder.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top