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