Java Eclipse导出带有源文件夹的游戏

时间:2017-09-15 21:10:09

标签: java eclipse export

我试图用一堆音乐导出我的游戏。当我用音乐导出游戏时(文件大小为300mb(资源文件夹大小约为300 MB))

当我运行jar时,我听不到声音。我尝试使用cmd它显示以下错误:

enter image description here

任何帮助?

修改

SoundManager类:

package com.memequickie.sound;

import java.io.File;
import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.Clip;

public class SoundManager {
    Clip clip;
    public boolean playSound(File sound) {
        boolean ended = false;
        try {
            clip = AudioSystem.getClip();
            clip.open(AudioSystem.getAudioInputStream(sound));
            clip.start();
            if(clip.getMicrosecondLength() == clip.getMicrosecondPosition()) 
            {
                ended = true;
            }
        } catch(Exception e) {
            System.out.println("Error with playing sound.");
            e.printStackTrace();
        }
        return ended;
    }

    public void stopSound() {
        clip.stop();
    }
}

修改 我尝试过输入流,仍然无法使其正常工作。 enter image description here

1 个答案:

答案 0 :(得分:0)

AudioSystem.getAudioInputStream(File) 期望 Music6.wav作为真实文件,作为JAR内的压缩文件 。< / p>

如果您要将音频文件发送到JAR中,则必须使用AudioSystem.getAudioInputStream(InputStream)BufferedInputStream包含$( '.table' ).each(function( i ) { var worktable = $(this); var num_head_columns = worktable.find('thead tr th').length; var rows_to_validate = worktable.find('tbody tr'); rows_to_validate.each( function (i) { var row_columns = $(this).find('td').length; for (i = $(this).find('td').length; i < num_head_columns; i++) { $(this).append('<td class="hidden"></td>'); } }); });