此编译单元不在 Java 项目的构建路径上 [英] This compilation unit is not on the build path of a Java project

查看:32
本文介绍了此编译单元不在 Java 项目的构建路径上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我尝试使用 ctrl+space 时显示此错误:

When I try to use ctrl+space this error is shown:

This compilation unit is not on the build path of a Java project.

我看到有类似的主题,但我的工作环境是 Eclipse,我从 Git 中提取我的项目(我将项目作为一般项目导入)并使用 Apache Ant.有人可以帮我吗?

I see that there are similar topics but my work environment is Eclipse and i pull my project from Git (I import project as general project) and i use Apache Ant. Can anyone help me?

推荐答案

由于您将项目作为通用项目导入,因此它不具有 java 性质,这就是问题所在.

Since you imported the project as a General Project, it does not have the java nature and that is the problem.

在工作区的 .project 文件中添加以下几行并刷新.

Add the below lines in the .project file of your workspace and refresh.

<natures>
      <nature>org.eclipse.jdt.core.javanature</nature>
</natures>

这篇关于此编译单元不在 Java 项目的构建路径上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆