The declared package does not match the expected package “”

前端 未结 21 2028
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 09:05

I am using Eclipse and have not used Java for sometime. However, I can compile my code on the command-line just fine and generate the necessary .class files. In

相关标签:
21条回答
  • 2020-12-01 09:34

    This problem got resolved by mentioning the package name

    I moved my file Test_Steps.java which was under package stepDefinition

    by just adding the package stepDefinition the problem got resolved

    So this problem can occur when you have a package and you are not using in your class file.

    Adding it has resolved the problem and the error was no longer appearing.

    0 讨论(0)
  • 2020-12-01 09:37
    1. Create directory [your.project.name] in workspace root directory of your project.

    2. Copy *.java from "src" to that directory.

    3. Close and reopen project.

    0 讨论(0)
  • 2020-12-01 09:37

    There are a million answers, but here's another one: copy the files into a new package, delete the old package and rename the new package to the old package's name.

    0 讨论(0)
提交回复
热议问题