value是有值的
String value = "1";  
if (value != null) {
      InputStream  stream = this.getClass().getResourceAsStream(value);
      System.out.print(stream);
      if (stream == null) {
        throw new IOException(UNABLE_TO_FIND_BINARY_RESOURCE);
      }
出现以下异常:stream为什么是空的 出现nullException 异常

解决方案 »

  1.   

    看了你的程序。。很费解。。你给VALUE赋值了。。又判断非空。。
    下面。。this.getClass().getResourceAsStream(value);。。这个是加载外部文件用的。。

    我不知道STREAM可以不可以直接OUT- -
      

  2.   

    你写的代码 和题目有什么关系?
    直接 value .getBytes() 不就完了
      

  3.   

    getResourceAsStream(资源文件路径),“1”算什么路径啊,当然得到null了
      

  4.   

    value在外部赋值为1,我是为了让大家看明白Value有值,并且是 String类型源程序是这样
    if (value != null) {
      InputStream stream = this.getClass().getResourceAsStream(value);
      System.out.print(stream);
      if (stream == null) {
      throw new IOException(UNABLE_TO_FIND_BINARY_RESOURCE);
      }
    出现以下异常:stream为什么是空的 出现nullException 异常
      

  5.   

    你看下this.getClass().getResourceAsStream()的API有时候问人,不如自己查。。
    然后你就知道为什么你传“1”进去是不行的。。
    三楼已经说的很明白了