You're getting this exception because you're trying to get an int
) when the next token is not recognised as an integer. Have a look at the docs for Scanner here
. In particular, hasNextInt()
will let you see if the next token is an int
will let you skip any non-int
input. Exactly how you want to do that depends on how strict/forgiving you want to be on the format of the configuration file.