0
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Scanner;

public class Scheduler {

    ProcessList processes = new ProcessList();
    int NUM_PROCESSES;
    int TOTAL_CPU_TIME = 0;
    File randomNumbers = new File("random-numbers.txt");
    Scanner numberScanner;

    public void getInput(String args[]) throws FileNotFoundException{

      Scanner inputScanner = new Scanner(System.in);
      numberScanner = new Scanner(randomNumbers);
      ArrayList<String> inputAsList = new ArrayList<String>();

      while (inputScanner.hasNext()){
        String nextInput = inputScanner.next();
        inputAsList.add(nextInput);
      }

      inputScanner.close();
      organizeInput(inputAsList);

    }
}

Whenever I try to red for numberScanner, I always get this error. I tried not closing my other scanner, inputScanner, as was suggested in other questions, but it didn't solve the issue.

dbalagula23
  • 307
  • 1
  • 5
  • 13
  • 2
    "I tried not closing my other scanner, inputScanner, as was suggested in other questions, but it didn't solve the issue." it is hard to believe. Do you have other Scanners which close `System.in`? – Pshemo Oct 08 '15 at 22:10
  • can you post up stack trace please? your whole code as long as is related to your issue? – Kick Buttowski Oct 08 '15 at 22:10
  • Have you tried using a decorator like this: http://stackoverflow.com/questions/14962082/close-scanner-without-closing-system-in – Has QUIT--Anony-Mousse Oct 08 '15 at 22:13

0 Answers0