Share on Google+Share on Google+

Java error reached end of file while parsing

Java Error reached end of file while parsing occurred when a programmer do not close the class braces properly.

Java error reached end of file while parsing


Java Error reached end of file while parsing  occurred when a programmer do not close the class  braces properly.

Understand with Example

In this Tutorial we want to describe you a code that help you in understanding  java error reached end of file while parsing ,In this code we want to display Time in hour, minute and second. For this we have a class name Reachedendof filewhileparsing,Inside this class we have a main method that declare a string, format name variable. We create an instance of class date and assign to a memory. The current hour, minute and second  is store in a variable f,that is further used to call format and date object passed as parameter in string variable. The System.out.println is used to display the time from the string. But on execution the code show an error i.e java error reached end of file while parsing as the class closing braces is not specified.

import java.text.*;
import java.util.Date;

public class Reachedendoffilewhileparsing {

  public static void main(String args[]) {

  String string;
  Format f;
  Date date = new Date();

  f = new SimpleDateFormat("hh:mm:ss ");
  string = f.format(date);
  System.out.println("Time is : " + string);



Compiling source file to /home/girish/NetBeansProjects/errors/build/classes
17: reached end of file while parsing

BUILD FAILED (total time: seconds)

To resolve this error you have to close the class properly by giving brace.

Download code


Posted on: November 3, 2008 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Java error reached end of file while parsing  

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
kirana A S
April 28, 2011
ie7 is not supporting to load .csv a file.

in our project we have a requirement of exporting the data into the csv file. we can modify the data and import again. this is working for all the scenerios. but there are some scenerios.we cant import the which was empty .csv(oonly header values will be there) and we filled with proper data. while importing these type of file it will load for some time. the browser will not support this.we are using java. this is working fine in the local machine. once we deploy the code on server(which is on linux) this issue is happening please help me
Michael Johnson
June 10, 2011
Java Programming I

Which way does the brace belong, { or }. I have public class BalanceInterest {. Is this the class that needs to be corrected?
August 11, 2012
ERROR message!

public int countInRange(int[] data, int lo, int hi) { int count = 0; for (int i =0; i<data.length; i++) { if (lo <= data[i] && hi >= data[i]) { count++; } } return count; } I've been trying to run this code, but i keep getting the 'reached end of file while parsing' error message! Please help me out!
August 27, 2012

thank u