Question: I want to play the `mp3` file in `java`. I am using a code but show the exception could not get audio input stream from input file. 
My source code is :

```
try {
        System.out.println("Start");
        File f = new File("E:\\malayalam good song\\01_ISHTAMANU.MP3");

        AudioInputStream audio = AudioSystem.getAudioInputStream(f);
        System.out.println("Start");
        AudioFormat format = audio.getFormat();
        DataLine.Info info = new DataLine.Info(SourceDataLine.class, format);
        SourceDataLine  auline = (SourceDataLine) AudioSystem.getLine(info);
        auline.open(format);
        auline.start();
        int nBytesRead = 0;
        byte[] abData = new byte[524288];
        while (nBytesRead != -1) {
            nBytesRead = audio.read(abData, 0, abData.length);
            if (nBytesRead >= 0) {
                auline.write(abData, 0, nBytesRead);
            }
        }
    } catch (Exception E) {
        System.out.println("Exception"+E.getMessage());
    }

```

Answer: 
If you are on `java 7`, there are new (`JavaFX`) classes there that are easier to use:

```
import javafx.scene.media.Media;
import javafx.scene.media.MediaPlayer;
...
...

try {
        File f = new File("E:\\malayalam good song\\01_ISHTAMANU.MP3");
        Media hit = new Media(f.toURI().toString());
        MediaPlayer mediaPlayer = new MediaPlayer(hit);
        mediaPlayer.play();
    } catch(Exception ex) {
        ex.printStackTrace();
        System.out.println("Exception: " + ex.getMessage());
    }

```

If you are not on `Java 7`, you can grab `JavaFX` jars from **[here](http://www.oracle.com/technetwork/java/javafx/downloads/index.html)**.
Dudes, I passed a night matter with this exception, man it was hard to find a solution, first of all, you will not need to alter your code or same thing like that at majority of the cases, you just need to convert the format of wav that you have, following this tutorial: [here](https://bgetutorials.wordpress.com/2007/12/02/converting-stereo-wav-to-mono-wav/)

But the thread started [here](https://groups.google.com/g/mobicents-public/c/koHpYMgpsP8)

After that I had another problem, basically it was saying that I can't play the sound because iceadtea-sound was not in library and yeah man, to solve that I runned a command:

`apt-get install openjdk-8-jre openjdk-8-jdk`

that I get on [here](https://readthefuckingmanual.net/error/6120)

And after this bug solved I come across another one named "Invalid format with getAudioInputStream, trying to play a sound in Java"

That bug I solved with this answer here on stackoverflow [here](https://stackoverflow.com/questions/30833342/invalid-format-with-getaudioinputstream-trying-to-play-a-sound-in-java)

And after this, finally a song was played