eclipse java 导入错误,org.jdom
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11731628/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
java import error, org.jdom
提问by Naturia Rock
ive been trying to do an import in my java project but i keep getting the following error.
我一直在尝试在我的 java 项目中进行导入,但我不断收到以下错误。
The import org.jdom cannot be resolved
i have created a lib folder under my project and have put the jar files from http://www.jdom.org/downloads/index.html
我在我的项目下创建了一个 lib 文件夹,并把来自http://www.jdom.org/downloads/index.html的 jar 文件
into there. there were a total of 8 different jar files which i added. then i added them in my build path. those 8 files are now in my referenced libraries. however that error keeps coming up. ive tried refreshing and cleaning my project but no luck.
进入那里。我总共添加了 8 个不同的 jar 文件。然后我将它们添加到我的构建路径中。这 8 个文件现在在我引用的库中。但是这个错误不断出现。我尝试刷新和清理我的项目,但没有运气。
am i supposed to do something different since its a org.jdom?
我应该做一些不同的事情,因为它是一个 org.jdom 吗?
my import statements are...
我的导入语句是...
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.jdom.output.Format;
import org.jdom.output.XMLOutputter;
thank you
谢谢你
回答by Peter Carpenter
I opened the jar file at the link you gave using 7zip. It looks like you will need to use the import statements: (Note the addition of the '2') "import org.jdom2.Document;"
我在您使用 7zip 提供的链接处打开了 jar 文件。看起来您将需要使用导入语句:(注意添加了“2”)“import org.jdom2.Document;”
回答by lory105
It depends from the library version!!
这取决于库版本!!
If you downloaded the version 1you MUST write:
如果您下载了版本 1,则必须编写:
import org.jdom.*
If you downloaded the version 2you MUST write:
如果您下载了第 2 版,则必须编写:
import org.jdom2.*
回答by Tell Me How
You should import jdom-1.1.3which is stable and work for me.
你应该导入jdom-1.1.3,它是稳定的并且对我有用。
回答by Vivek Vermani
Could be because of the package rename in later versions. The later version shows the package name as dom2 instead of dom.
可能是因为更高版本中的包重命名。更高版本将包名称显示为 dom2 而不是 dom。