eclipse/subclipse 项目未显示红线错误

发布于 2024-12-11 09:10:02 字数 105 浏览 0 评论 0原文

我正在为学校做一个小组项目。我从存储库中检查了该项目。当我编写代码时,语法错误的红线不会显示。所以我在我的机器上创建了一个单独的java项目,并且红线错误确实出现在那里。所以我不知道发生了什么事。

I'm working on a group project for school. I checked the project out from the repository. When I write code, the red lines for syntax errors don't show up. So I made a separate java project on my machine and red line errors do show up there. So I don't know whats going on.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(6

浮光之海 2024-12-18 09:10:02

Eclipse 突然停止在代码和问题视图中显示编译错误。

我创建了一个动态 Web 项目,添加了一个 servlet,一切都很顺利;编译错误正确显示。

我右键单击 MyProject->Configure->ConvertToMavenProject 并开始出现问题。在我的BuildPath中,JRE版本从1.6更改为1.5;这导致了一些以前未报告的编译问题,当我改回 1.6 后,这些问题就消失了。

但现在,代码中没有出现编译错误。

原因是,转换为 Maven 项目也从构建路径中删除了我的 src 文件夹。我将 src 文件夹添加回构建路径,一切顺利。

Eclipse suddenly stopped showing compile errors, both in the code and in the Problems view.

I had created a Dynamic Web Project, added a servlet and everything was groovy; compilation errors showed up properly.

I did right click on MyProject->Configure->ConvertToMavenProject and problems started. In my BuildPath, the JRE version was changed from 1.6 to 1.5; this caused some previously unreported compilation problems that went away as soon as I change back to 1.6.

But now, no compilation errors showed up in the code.

The reason was, converting to a maven project also removed my src folder from the build path. I added the src folder back to the build path and things are peachy.

相权↑美人 2024-12-18 09:10:02

右键单击您的项目并转到“属性”> Java 构建路径 >来源。

确保您的源目录(例如MyProject/src)被列为源文件夹。否则你不会得到任何红色标记。

Right-click your project and go to Properties > Java Build Path > Source.

Make sure your source directory (for example MyProject/src) is listed as a Source folder. Otherwise you won't get any red markers.

-小熊_ 2024-12-18 09:10:02

波浪线是可配置的;在首选项中查看常规 ->外观->编辑->文本编辑器 ->注释和“错误”注释类型。

Squiggles are configurable; in Preferences see General -> Appearance -> Editors -> Text Editors -> Annotations and the "Errors" annotation type.

江城子 2024-12-18 09:10:02

确保您的 .project 文件看起来像这样:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>ProjectName</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

如果它不像上面那样,那么您将无法进行语法检查,也无法获得 Java 项目附带的许多其他功能。

Make sure your .project file looks something like this:

<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
    <name>ProjectName</name>
    <comment></comment>
    <projects>
    </projects>
    <buildSpec>
        <buildCommand>
            <name>org.eclipse.jdt.core.javabuilder</name>
            <arguments>
            </arguments>
        </buildCommand>
    </buildSpec>
    <natures>
        <nature>org.eclipse.jdt.core.javanature</nature>
    </natures>
</projectDescription>

If it doesn't look like the above, then you aren't going to get syntax checking, as well as a number of other features that come along with Java projects.

殊姿 2024-12-18 09:10:02

我也有这个问题。一个项目之后-->干净了,我又恢复正常了。

编辑...再次发生 - 意识到我不小心取消选中了“项目 --> 自动构建”菜单选项。现在按预期工作。

I had this problem as well. After a project --> clean, I'm back to normal.

Edit ... Happened again - realized that I had accidentally unchecked the "Project --> build-automatically" menu option. Now working as expected.

淑女气质 2024-12-18 09:10:02

去检查是否在你的Java Build Path ->图书馆有一个丢失的罐子。
当我删除我的案例中丢失的罐子时,自动错误再次显示。

Go to check whether in your Java Build Path -> Libraries has a missing jar.
When I remove that missing jar in my case, the auto-error shows again.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文