In addition to AurA's answer ...
You can use the JLayer library to easily read and play most Internet radio stations. This library is also cross-platform and, in addition, allows you to play any mp3 file.
Here is an example of a small thread:
import javazoom.jl.decoder.JavaLayerException; import javazoom.jl.player.Player; import java.io.IOException; import java.net.URL; import java.net.URLConnection; public class RadioConnector { public static void main ( String[] args ) { try { playRadioStream ( "http://radio.flex.ru:8000/radionami" ); } catch ( IOException e ) { e.printStackTrace (); } catch ( JavaLayerException e ) { e.printStackTrace (); } } private static void playRadioStream ( String spec ) throws IOException, JavaLayerException {
Please note that the playRadioStream method will process the stream that it calls until something happens (for example, the connection to the radio server is disconnected or you stop the stream).
PS Yes, I included the working URL as an example - you can try to start it and your computer will start playing the radio stream.
source share