質問するログイン新規登録

質問編集履歴

1

ソースの追加

2016/07/11 06:42

投稿

javabigineer
javabigineer

スコア87

title CHANGED
File without changes
body CHANGED
@@ -5,4 +5,45 @@
5
5
  ある場合、何が原因として考えられるのでしょうか?
6
6
 
7
7
  ご存知の方いらっしゃいましたら、ご教授ください。
8
- お願いいたします。
8
+ お願いいたします。
9
+
10
+ ```
11
+ public Workbook excelRead(String excelPath) {
12
+ FileInputStream is =null;
13
+ Workbook wb = null;
14
+ try {
15
+ is = new FileInputStream(excelPath);
16
+ wb =WorkbookFactory.create(is);
17
+
18
+ } catch (FileNotFoundException e) {
19
+ e.printStackTrace();
20
+ } catch (EncryptedDocumentException e) {
21
+ e.printStackTrace();
22
+ } catch (InvalidFormatException e) {
23
+ e.printStackTrace();
24
+ } catch (IOException e) {
25
+ e.printStackTrace();
26
+ }finally{
27
+ try {
28
+ is.close();
29
+ } catch (IOException e) {
30
+ e.printStackTrace();
31
+ }
32
+ }
33
+
34
+ return wb;
35
+
36
+ }
37
+
38
+ java.io.FileNotFoundException: "C:\aaa\bbb\test.xls" (ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。)
39
+ at java.io.FileInputStream.open0(Native Method)
40
+ at java.io.FileInputStream.open(FileInputStream.java:195)
41
+ at java.io.FileInputStream.<init>(FileInputStream.java:138)
42
+ at java.io.FileInputStream.<init>(FileInputStream.java:93)
43
+ at knowledge.ExcelOpe.excelRead(ExcelOpe.java:34)
44
+ at PCkanriweekly.WeeklyCheck.main(WeeklyCheck.java:84)
45
+ Exception in thread "main" java.lang.NullPointerException
46
+ at knowledge.ExcelOpe.excelRead(ExcelOpe.java:47)
47
+ at PCkanriweekly.WeeklyCheck.main(WeeklyCheck.java:84)
48
+
49
+ ```