java.util.scanner - Scanner class in Java5 throw java.lang.NullPointerException -
i using scanner class in java5, , following code throw exception:
scanner scanner = new scanner (new file(args[0])); int dealid; while (scanner.hasnextline()) { dealid = scanner.nextint(); system.out.println(dealid); } scanner.close();
the stacktrace is:
exception in thread "main" java.lang.nullpointerexception @ java.util.regex.matcher.tomatchresult(libgcj.so.10) @ java.util.scanner.mycorenext(libgcj.so.10) @ java.util.scanner.mypreparefornext(libgcj.so.10) @ java.util.scanner.mynextline(libgcj.so.10) @ java.util.scanner.hasnextline(libgcj.so.10)
does knows caused exception?
the gcj home page suggest "supports of 1.4 libraries plus 1.5 additions. "
scanner added in version 1.5 , suspect have hit piece of functionality gcj doesn't support. need try different see can work.
is there reason not using openjdk/oracle java 6 or 7? (please don't performance reasons ;)
Comments
Post a Comment