简体   繁体   English

声明的 package “” 与 Visual Studio Code 中预期的 package “src” 不匹配

[英]The declared package “” does not match the expected package “src” in Visual Studio Code

I originally had all my.java files under a file named "GravityBallz", but I then created a folder called "src" inside the GravityBallz folder and put them all in there.我最初将所有 my.java 文件放在一个名为“GravityBallz”的文件下,但后来我在 GravityBallz 文件夹中创建了一个名为“src”的文件夹并将它们全部放在那里。 Now it's giving me an error.现在它给了我一个错误。 I tried restarting but still didn't work.我尝试重新启动,但仍然没有工作。

Thanks谢谢

So here is the src folder I added所以这是我添加的 src 文件夹

And here are all the problems I'm getting for all the.java files这是我为所有.java文件遇到的所有问题

Because you had put your java file in 'src' folder, so you need to add "package src" in every java file.因为您已将 java 文件放在“src”文件夹中,所以您需要在每个 java 文件中添加“package src”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 声明的 package “” 与预期的 package “src” 不匹配 - The declared package “” does not match the expected package “src” 声明的包<package name>与 VS 代码中的预期包“”不匹配 - The declared package <package name> does not match the expected package "" in VS code VS Code:声明的包“controller”与预期的包“”不匹配 - VS Code: The declared package "controller" does not match the expected package "" Eclipse声明的软件包与预期的软件包不匹配 - Eclipse declared package does not match expected package 声明的包“”与预期的包不匹配 - The declared package "" does not match the expected package 声明的软件包测试与预期的软件包不匹配 - The declared package test does not match the expected package libgdx:声明的软件包与预期的软件包“”不匹配 - libgdx: The declared package does not match the expected package “” 声明的包与预期的包“”不匹配 - The declared package does not match the expected package “” Eclipse:声明的包与预期的包不匹配 - Eclipse: The declared package does not match the expected package “声明的 package '' 与预期的 package ”AssignmentOne.java“” -Java -VS 代码不匹配 - “The declared package '' does not match the expected package ”AssignmentOne.java“” -Java -VS Code
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM