Eclipse未找到添加到构建路径的类(Java Dynamic Web Project) [英] Eclipse Not Finding Classes added to the build Path (Java Dynamic Web Project)

查看:266
本文介绍了Eclipse未找到添加到构建路径的类(Java Dynamic Web Project)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗯,呃,呃b $ b我正在接受我学校的一个网络项目。我正在eclipse中部署该项目。该项目使用一组库(即javax.mail。*,com.sun.mail。,org.joda。和org.apache。*)。该项目无法编译,因为它无法找到这些。我将它们放在src文件夹中,然后将三个顶级文件夹/包添加到构建路径。导入语句工作。但是获取joda.time.CLASSXYZ不起作用(我实例化CLASSXYZ类)。 (错误是org.joda.time.base.BaseDateTime类型无法解析,它是从所需的.class文件间接引用的导入是joda.time。*所以应该已经被导入了)



我看过其他线程,其中大多数只是解释如何添加文件夹到构建路径。我用apache设置apache。它与我部署的其他项目配合使用。



这个问题让我非常沮丧,因为它阻止我启动项目。任何帮助你非常感激。



干杯

解决方案

您提到的其他线程指向你正确的方向,并提供一个良好的做法进入(特别是一旦你开始有多个项目运行在你的eclipse ide)。



所以右键单击项目 - 构建路径 - 配置构建路径...,然后在库选项卡中,单击添加外部JAR,然后从另一个答案中的链接中添加到org.joda的jar中。这样,您可以将所有外部jar库放在一个位置,并在多个项目中重用它们。还有大约十几种不同的方式在日食中做同样的事情,但这是我认为最直接的。我在Helios版本上(你的可能略有不同)。我尽量不要使用外部代码库的源文件,除非我想玩,调试他们的代码 - 不是一件坏事 - 但是我从来没有时间为此。



另外,我会仔细检查您提到的其他库不被自动链接或作为JRE系统库的一部分。特别是如果您在动态Web项目中进行设置,那么如果org.apache不在那里,那么我会感到非常惊讶,但是我可以很容易地在那里出错,已经很久以前了。 eclipse通常涉及; - )


Hey guys, I am taking over a web project from my school. I am trying to deploy the project in eclipse. The project uses a group of libraries (Namely javax.mail.* , com.sun.mail., org.joda. and org.apache.* ). The project can not compile because it is unable to locate these. I have them in the src folder and then added the three top level folders/packages to the build path. The import statements work. But getting the joda.time.CLASSXYZ does not work (The I instantiate the class CLASSXYZ). (The error is "The type org.joda.time.base.BaseDateTime cannot be resolved. It is indirectly referenced from required .class files" the import was joda.time.* so the class should have been imported)

I've looked at the other threads and most of them just explain how to add folders to the build path. I have apache tomcat set up with eclipse. It works with other projects that I have deployed.

This problem has gotten pretty frustrating as its preventing me from starting the project. Any help you be much appreciated.

Cheers

解决方案

The other threads you mentioned are pointing you in the right direction, and provide a good practice to get in to (especially once you start having more than one project running in your eclipse ide).

So right click project - Build Path - Configure Build Path... , then in the Libraries tab, click Add External JARs and add in the jar for org.joda from the link in the other answer here. This way you can have all your external jar libraries in one spot and reuse them across multiple projects. There's also about a dozen different ways to do the same thing in eclipse, but this is the most direct I think. I'm on version Helios (your's might be slightly different). I try not to use source files of external code libraries unless I want to play around, debugging their code - not a bad thing to do - but I never have the time to spare for that.

Also I'd double check that the other libraries you mentioned aren't being automatically linked in or included as part of the JRE system library. Especially if you are setup in a Dynamic Web Project, it would surprise me if org.apache wasn't already there... but I could easily be wrong there, have been many times before & eclipse was usually involved ;-)

这篇关于Eclipse未找到添加到构建路径的类(Java Dynamic Web Project)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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