1

此代码工作正常,并在 jGRASP 中播放声音,但是当它从 IDEA 或 Eclipse 中的项目运行时,没有声音播放。我怎样才能让它在所有 IDE 上工作?

public void playClip( String clipPlay ){
    AudioClip clip = null;
    File filePlay = new File( clipPlay );

    try{
        clip = Applet.newAudioClip( filePlay.toURI().toURL() );
    }
    catch( MalformedURLException ex ){
        System.err.println( ex.getMessage() );           
    }

    clip.play();
}
4

0 回答 0