• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Code compilation error

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How do I rectify this one line error on the console?:
'reached end of file while parsing' for my java code in attempting to compile the code over and over after fixing(to the best of my observation)every apparent bug. To the best of my understanding, this is not mechanical or syntactical error...
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You'll get that error if you have more opening { than closing }.
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why not show us the code?
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is your code properly aligned? As Joanne says, you have (at least) one opening '{' that does not have a matching '}'. having everything indented right can help find these problems, as can just about any code editor. most have a "find matching brace" function. you set your cursor by one, and it will either highlight the match or let you jump to it.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
While what Joanne says makes 100% sense, I've never seen a Java compiler actually issue that diagnostic (rather than "missing '}'", for example,) and a few attempts to evoke it have failed. Joanne, fred, have you actually seen this error message?
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
With Java 1.6 Update 7 you get the 'reached end of file while parsing' error. With Java 1.4.2_12 you get the } expected error.

And just for completeness, Java 1.3 and 1.5 also give the } expected error, although Java 1.3 specifies a different line number.
So it looks like it was changed in Java 6 for some reason.
[ August 28, 2008: Message edited by: Joanne Neal ]
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic