If the input file is always part of your application (i.e. you also put this into the .jar file later) you should use getResourceAsStream()
in order to read its contents.
InputStream in = getClass().getResourceAsStream(filename);
Scanner scanner = new Scanner(in);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…