Java 我收到此异常:未解决的编译问题
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2273103/
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
I'm getting this exception : Unresolved compilation problems
提问by Stephan
I get this exception after i removed from my project the jars (pdfbox ,bouncycastle etc) and moved them to another folder but i included them in the build path ...
从我的项目中删除罐子(pdfbox,bouncycastle 等)并将它们移动到另一个文件夹后,我收到此异常,但我将它们包含在构建路径中......
at the first line eclipse shows this error( the constructor PDFParser(InputStream) refers to missing type InputStream) -altought FileInputStream is extended from InputStream- and i don't know why?
在第一行 eclipse 显示此错误(构造函数 PDFParser(InputStream) 指的是缺少类型 InputStream)-altought FileInputStream 是从 InputStream 扩展的-我不知道为什么?
FileInputStream in = new FileInputStream(path);
PDFParser parser = new PDFParser(in);
PDFTextStripper textStripper = new PDFTextStripper();
parser.parse();
String text = textStripper.getText(new PDDocument(parser.getDocument()));
any ideas? **
有任何想法吗?**
Exception in thread "AWT-EventQueue-0" java.lang.Error: Unresolved compilation problems:
The constructor PDFParser(InputStream) refers to the missing type InputStream
The constructor PDFTextStripper() refers to the missing type IOException
The method parse() from the type PDFParser refers to the missing type IOException
The method getText(PDDocument) from the type PDFTextStripper refers to the missing type IOException
The method getDocument() from the type PDFParser refers to the missing type IOException
The method getDocument() from the type PDFParser refers to the missing type IOException
The method close() from the type COSDocument refers to the missing type IOException
**
**
回答by Jon Skeet
That just means your project hasn't compiled, but you've still tried to run it. Eclipse lets you do that, only failing when you first try to call something which didn't compile properly.
那只是意味着您的项目尚未编译,但您仍然尝试运行它。Eclipse 允许您这样做,只有在您第一次尝试调用未正确编译的内容时才会失败。
Look at the compilation errors in your project to track down the real problem. It does seem odd that it can't find InputStream
: did you remove a bunch of import statements from your code at the same time?
查看项目中的编译错误以找出真正的问题。找不到它似乎很奇怪InputStream
:您是否同时从代码中删除了一堆 import 语句?
回答by GHad
You may try a refresh on the project along with clean within eclipse (Project > Clean > All).
您可以尝试刷新项目以及 eclipse 中的清理(项目 > 清理 > 全部)。
Greetz, GHad
格雷茨,GHa
回答by meriton
A "missing type" error means the corresponding type is not found in the build path. InputStream would be in the JRE classpath container. Did you remove the JRE classpath container or might it be referring to a wrong location?
“缺少类型”错误意味着在构建路径中找不到相应的类型。InputStream 将位于 JRE 类路径容器中。您是否删除了 JRE 类路径容器,或者它可能指的是错误的位置?
The second hitwhen searching for
搜索时的第二次命中
"missing type" inputstream
“缺失类型”输入流
on google might also be helpful.
在谷歌上也可能有帮助。
回答by Kingz
Eclipse is trying to tell you that the referenced type is "missing" in the class type you are using. Imagine you have Class A, B, and C, where B references C as a field variable; while say, invoking B.setC() in class A, you will see the "refers to missing type" error, if C cannot be reached by B. So check B to see if (1) B is compiled OK, and the imported C is in compile/build path.
Eclipse 试图告诉您,您正在使用的类类型中“缺少”了引用类型。假设您有 A、B 和 C 类,其中 B 将 C 作为字段变量引用;比如说,在类 A 中调用 B.setC(),如果 B 无法访问 C,您将看到“引用缺失类型”错误。因此请检查 B 以查看 (1) B 是否编译正常,以及导入的C 在编译/构建路径中。