在我从我的项目中删除 jars(pdfbox、bouncycaSTLe 等)并将它们移动到另一个文件夹但我将它们包含在构建路径中后,我得到了这个异常......
在第一行,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()));
有什么想法吗? **
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
**
最佳答案
这只是意味着您的项目尚未编译,但您仍然尝试运行它。 Eclipse 允许您这样做,只有当您第一次尝试调用未正确编译的内容时才会失败。
查看项目中的编译错误以找出真正的问题。它找不到 InputStream
确实很奇怪:您是否同时从代码中删除了一堆导入语句?
关于java - 我收到此异常 : Unresolved compilation problems,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2273103/