preface

Hello everyone, I am Baimo, a person who loves learning and paddling.

Yesterday in order to figure convenient, using the Swing function of MyEclipse to draw the interface, painting after found that it can not run, check the source code found full error, a face meng than.

I in line with the principle of thinking twice before the event (can not do, can not hand over to others to do, can do tomorrow), put off to today to solve.

Today, after asking baidu and sand sculpture group friends in vain, I went to consult the lecturer, who told me that “either there is no JRE, or the braces are missing”, so I went to find where the braces are missing.

The error message

Exception in thread "main" java.lang.Error: Unresolved compilation problem: Syntax error on token "}", delete this token

The solution

I am inFound before main methodAn incomplete or even wrong method. In myDelete/comment those two lines of codeAfter that, there was no error. Perfect solution.Other reference solutions:

  1. Copy the code to Notepad, create a new class, and paste the code back.
  2. Create a new project and copy the class that reported the error into the new class. (Can sometimes solve the problem of exclamation marks)

I’m not sure what the reason is for this metaphysical solution.

conclusion

An error occurred when Eclipse automatically generated the code! The code is not generated completely, often with one more or less closing curly brace “} “. Look carefully at the code to see if each method is complete, manually correct or delete the error can be resolved.

Well, that’s all for this article! If it helps you, I can have itLike + favorites + follow! Your encouragement is my motivation to renew!