2012-10-28 68 views
0

我正在嘗試讀取名爲circle1的.bmp文件,該文件是已導入包含以下方法的類的包。在java中讀取.bmp文件時拋出llOExcption

到目前爲止,我有下面的代碼,但是當我運行下面的代碼我得到:

javax.imageio.llOException:無法讀取輸入文件!

public void setUp() throws IOException 
{ 
    // minimumOverlapScore < synapsesPerSegment(not yet a field) 

    BufferedImage image = ImageIO.read(new File("circle1.bmp")); 
    byte[][] greenInputData = new byte[30][40]; 

    for (int x = 0; x < inputData.length; x++) 
    { 
     for (int y = 0; y < inputData[x].length; y++) 
     { 
      int color = image.getRGB(x, y); 
      //alpha[x][y] = (byte)(color>>24); 
      //red[x][y] = (byte)(color>>16); 
      greenInputData[x][y] = (byte)(color>>8); 
      //blue[x][y] = (byte)(color); 
     } 
    } 
    this.inputData = greenInputData; 

    System.out.println(this.inputData); 
} 
+1

是jar裏面的bmp,​​還是磁盤上的文件? – Bohemian

回答