我正在获得资源不在项目的构建路径 [英] I am getting resource not on the buildpath of the project

查看:186
本文介绍了我正在获得资源不在项目的构建路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在获得当我尝试组织导入或尝试访问任何类属性时,资源不在项目的构建路径上。
我正在使用ant构建我的项目。我试图在javabuilpath - >项目中配置我的构建路径,但它没有显示我的src文件夹。我无法使用快速辅助(ctrl + space)和类相关属性由于同样的原因
,它也不会在我写代码时显示任何语法错误。



请帮助我。

谢谢

解决方案

我刚刚遇到这个问题,这真让人困惑。当您尝试使用Java文件处理Java文件时,您会收到一堆不同的地方,但是Eclipse并没有想到它实际上是您项目中的一个类。它不知道的原因(或在我的情况下不知道的原因)是因为目录没有被标记为项目的源目录。因此,您需要告诉项目配置文件是否在保存源文件的目录中。方法如下:


  1. 打开项目的属性。


  2. 在Java构建路径下,点击源选项卡。


  3. 点击添加文件夹...


  4. 找到您无法识别的java文件的文件夹。 (在我的
    的情况下,它是测试 - > Java)


  5. 对文件夹进行检查。 (我把它只是由java,而不是由
    测试,因为测试文件夹包含很多其他的东西。)


  6. 点击确定,再次点击确定,也许刷新,你应该是
    去。



I am getting The resource is not on the buildpath of the project when I am trying to "Organize imports" or trying to access any class properties. I am building my project with ant.I tried to configure my buildpath in javabuilpath -> Projects but it is not showing me my src folder there.I am not able to use quick assist (ctrl + space) and class related properties because of the same reason and it does not show me any syntax errors also while i am writing my code.

please help me.

thanks

解决方案

I just hit this problem myself, and it's baffling. You get it in a bunch of different places as you try and treat a Java file as, you know, a Java file but Eclipse hasn't figured out that it's actually a class within your project. The reason it doesn't know (or the reason it didn't know in my case) was because the directory hasn't been marked as a source directory for the project. So you need to tell the project configuration that the file is in a directory that holds source files. Here's how:

  1. Open your project's properties.

  2. Under "Java Build Path", click on the "Source" tab.

  3. Click "Add Folder..."

  4. Find the folder where you have the unrecognized java file. (In my case it was test->Java)

  5. Put a check by the folder. (I put it only by "java" and not by "test" given that the test folder holds a lot of other stuff.)

  6. Click ok, click OK again, perhaps refresh, and you should be good to go.

这篇关于我正在获得资源不在项目的构建路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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