Exception in thread "main" java.util.NoSuchElementException


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Exception in thread "main" java.util.NoSuchElementException

  1. #1
    Join Date
    Sep 2007
    Posts
    2

    Exception in thread "main" java.util.NoSuchElementException

    Hi all

    I am here and i am getting a problem with the following code. I am reading a text file in to a jtable. i am unsure whats happening. Do you have any ideas.
    Thanks

    Exception in thread "main" java.util.NoSuchElementException
    at java.util.Scanner.throwFor(Scanner.java:838)
    at java.util.Scanner.next(Scanner.java:1347)
    at QuestionController.load(QuestionController.java:69)
    at QuestionController.<init>(QuestionController.java:20)
    at QuestionController.main(QuestionController.java:173)
    Press any key to continue . . .

    It is working now thanks
    Last edited by jc80; 09-18-2007 at 11:29 AM.

  2. #2
    Join Date
    Dec 2004
    Location
    San Bernardino County, California
    Posts
    1,468
    Your Scanner is not working properly. Have you debugged it? Are there ANY elements being read? My guess is that your delimiter is not being applied as your implementation predicts.

  3. #3
    Join Date
    Sep 2007
    Posts
    2
    It was an unkown character in my data file, I removed it. It works fine now. Thanks

Similar Threads

  1. Getting a thread to throw an exception
    By jjamesis in forum Java
    Replies: 4
    Last Post: 04-02-2007, 05:37 PM
  2. Replies: 4
    Last Post: 03-29-2007, 02:30 PM
  3. Replies: 1
    Last Post: 02-23-2007, 04:31 AM
  4. Exception in thread main error
    By mako_123 in forum Java
    Replies: 2
    Last Post: 06-29-2006, 03:09 AM
  5. Replies: 1
    Last Post: 04-25-2006, 08:36 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center