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

查看:2352
本文介绍了此编译单元不在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天全站免登陆