the codes running ok on NetBeans, and wih the error messages while I am running the jar file. Any helps with the following code would be very appreciated.

Scanner file = null;

while(file.hasNext()){
          if (file.hasNextInt()) list.add(file.nextInt());
              else file.next();
      }
Re: thread main java.lgang.NullPointerExeption 80 80

how can file have a next? you haven't even initialized file, you just declared it to be null.
so, with: file.hasNext()
you are calling a method on null. that is what causes the NullPointerException.

if this is not your issue, please provide the correct code and stacktrace.

Re: thread main java.lgang.NullPointerExeption 80 80

Replace your code as :

Scanner scan = new Scanner(System.in); // Or whichever stream your //program is trying to read from ... I would have used InputStreams //instead

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.