Java 使用ApachePOI时出现异常
我正在使用ApachePOI,我正在运行这段代码Java 使用ApachePOI时出现异常,java,exception,apache-poi,Java,Exception,Apache Poi,我正在使用ApachePOI,我正在运行这段代码 POIFSFileSystem fs = null; fs = new POIFSFileSystem(new FileInputStream("myDoc")); HWPFDocument document = new HWPFDocument(fs); WordExtractor word = new WordExtractor(document); String[] paragraphs = word.getParagraphText()
POIFSFileSystem fs = null;
fs = new POIFSFileSystem(new FileInputStream("myDoc"));
HWPFDocument document = new HWPFDocument(fs);
WordExtractor word = new WordExtractor(document);
String[] paragraphs = word.getParagraphText();
System.out.println( "First paragraph text: " + paragraphs[0]);
它给了我这个例外
Exception in thread "main" java.io.FileNotFoundException: myDoc (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
现在我如何解决这个问题。文件
myDoc
不存在。myDoc
是一个变量还是您的意思是myDoc.doc
?word文档文件没有扩展名真是太神奇了。那个文件存在吗?你试过直接从你的驱动器打开它吗?!什么是我的医生。给出文件的完整路径。