Wenn ich ein etwas längeres Lied öffne bekomme ich bei meinem Musikplayer immer folgende Fehler in der Konsole...ich kann dann keine Lieder mehr abspielen 
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
at Audio.Soundplayer(Audio.java:25)
at MAIN$1.actionPerformed(MAIN.java:43)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Der Übeltäter schein wohl diese Zeile hier zu sein
Die Zeile ist dafür verantwortlich das ich lieder aus meiner Playlist abspielen kann
Das playPlaylist.urlToFile ist diese FKT...diese wandelt die Adreese der Files in eine URL um sodass diese dann in einen Filecontainer gespechert werden kann
Hier ist noch die audio klasse mit der soundplayer FKT
ich hoffe ihr könnt mir helfen
Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space
at com.sun.media.sound.DirectAudioDevice$DirectClip.open(Unknown Source)
at Audio.Soundplayer(Audio.java:25)
at MAIN$1.actionPerformed(MAIN.java:43)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Der Übeltäter schein wohl diese Zeile hier zu sein
Code:
MAIN.audio.Soundplayer(playPlaylist.urlToFile((String) DnD.table.getValueAt(DnD.table.getSelectedRow(), 1)));
Das playPlaylist.urlToFile ist diese FKT...diese wandelt die Adreese der Files in eine URL um sodass diese dann in einen Filecontainer gespechert werden kann
Code:
import java.io.File;
import java.net.MalformedURLException;
import java.net.URISyntaxException;
import java.net.URL;
public class playPlaylist {
static URL url;
static File urlToFile(String pfad) {
File file = null;
try {
url=new URL(pfad);
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
file=new File(url.toURI());
} catch (URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
file = new File(url.getPath());
return file;
}
}
Hier ist noch die audio klasse mit der soundplayer FKT
Code:
import javax.sound.sampled.*;
import javax.swing.JLabel;
import javax.swing.JSlider;
import javax.swing.Timer;
import java.io.*;
public class Audio {
Clip clip;
public void Soundplayer(File f) throws UnsupportedAudioFileException, IOException, LineUnavailableException{
AudioInputStream ain = AudioSystem.getAudioInputStream(f);
try {
DataLine.Info info = new DataLine.Info(Clip.class, ain.getFormat());
clip = (Clip) AudioSystem.getLine(info);
clip.open(ain);
} finally
{
ain.close();
}
}
public void play(){
clip.start();
}
public void stop(){
clip.stop();
}
}