Fix Java error message “Reached End of File While Parsing”

“Reached End of File While Parsing” is a common mistake when writing application using Java. It happens if a closing curly bracket for a block of code such as class and method is missing. It also happens when an IDE builds source code which contains unicode characters such as Chinese characters.

Missing curly bracket is easy to fix, just proofread or use an editor like Visual Studio Code, Android Studio.

When building unicode source code, use a code editor which supports unicode by default. You can even contact supporter of the code editor if error still happens.

Example

public class Main {
	public static void main(String[] args) {
		System.out.println("My program is running..");
}

There is a missing bracket after the System.out.println line. The compiler cannot parse the code properly and will throw the error.

Leave a Comment

Your email address will not be published. Required fields are marked *


Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close