Reached End of File While Parsing

This is a compile error, easily fixed

Generic Java code
KIVILCIM PINAR / Getty Images

The Java error message Reached End of File While Parsing results if a closing curly bracket for a block of code (e.g, method, class) is missing.

The fix is easy — just proofread your code.

Example

In the code below, the method called main does not conclude with a closing curly bracket. The compiler cannot parse the code properly and will throw the error.

public class Main {
public static void main(String[] args) {
System.out.println("Oops missed a curly bracket..");
}

Avoiding the Error

Because this error is both common and easily avoided, using a code editor like Visual Studio Code or an integrated development environment like Eclipse. Code editors that feature linters and syntax checkers for Java (or whatever language you use) will uncover errors before you attempt to compile.

Format
mla apa chicago
Your Citation
Leahy, Paul. "Reached End of File While Parsing." ThoughtCo, Aug. 27, 2020, thoughtco.com/reached-end-of-file-while-parsing-2034285. Leahy, Paul. (2020, August 27). Reached End of File While Parsing. Retrieved from https://www.thoughtco.com/reached-end-of-file-while-parsing-2034285 Leahy, Paul. "Reached End of File While Parsing." ThoughtCo. https://www.thoughtco.com/reached-end-of-file-while-parsing-2034285 (accessed April 23, 2024).