Coding challenge

How can I make Java open a .mp3 ? In order words How can I play mp3 file in Java ?

Basically, you need to find a library that can play mp3 files. Presumably, there is also a way to use primitive Java to do it, but that is not the way any programmers I know of would do it. A professional programmer would use a library.

One such library is JavaFx which used to be packaged with the JDK in Java 8-10. Another is JLayer. You have to use the library’s documentation to see how it is used (or look for others using it). You may also need to check licensing to make sure your usage is legal. Typically if this is educational it is considered fair use, but many of these types of libraries are “open source” which means they have a license that allows them to be used by just about anyone for free (which includes the current state of JavaFX).

Good luck!

1 Like

Thank you so very much