Greetings all. I have a rather interesting problem with the Scanner class, and Google hasn't been able to help.

Some background: I just bought a new laptop for college and am dual-booting Linux and Vista (because it comes standard with Vista). On my old laptop I had XP, so I used that primarily for programming, but now that I have to have Vista I'm using mainly Ubuntu for coding.

I transferred over my files and tried to execute one of my programs. The particular section giving the error is supposed to read in a configuration file ("config.inf") and set the look and feel and other options based on what it finds; the part of config.inf it's looking for comes after a '#' character, so it reads through until it gets there, reads the next line, and acts on that line's contents. On XP it works perfectly; on Ubuntu the Scanner class doesn't seem to want to work. This:
Code:
          try
         {
            Scanner in=new Scanner(new File("config.inf")).useDelimiter("\r|\r\n|\n");
            String temp="";
            while(in.hasNextLine())
            {
               temp=in.nextLine();
               if(temp.contains("#"))
                  break;
            }
            temp=in.nextLine();
            //do stuff
         }
             catch(IOException io)
            {
            //do other stuff
            }
returns a NoSuchElementException at the "temp=in.nextLine();" right after the while loop. I've tried to debug it and for some reason it thinks config.inf is empty; printing the value of temp has no effect because the while loop apparently never executes.

My best guess was that the Windows line separator difference ("\r\n" instead of '\n') is the problem, so I set the Scanner to use both kinds of delimiters, but that didn't work. If that is the issue, and I just didn't fix it correctly, does anyone know how to fix that? If not, does anyone know what the problem actually is?

Thanks in advance for your assistance.