Syntax error on token & quot; package & quot;, assert expected ------ step-on logging, expectedbeforetoken

Source: Internet
Author: User

Syntax error on token "package", assert expected ------ step logging, expectedbeforetoken

Today, I encountered a pitfall when writing a program. eclipse Editor, JDK 1.7, and clean compiled the project and reported the error Syntax error on token "package", assert expected.

I repeatedly checked whether there were spelling errors or grammar rule errors. It was a bit confusing...

The information provided by the remote engineer is whether the package statement is in the first line, whether the import Statement is prior to the package statement, and whether there are multiple curly braces. Of course, none of them are possible... this is all the mistakes made by new people who just learned java. Okay...

After a variety of attempts, I finally found the problem: encoding.

It may be that the encoding format of the entire project is changed to GBK and changed to UTF-8 and clean. The problem is solved.

In the future, when you encounter a strange compilation problem, you may first look at the encoding format, whether it is still familiar with UTF-8...

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.