質問編集履歴

1

ソースの追加

2016/07/11 06:42

投稿

javabigineer
javabigineer

スコア87

test CHANGED
File without changes
test CHANGED
@@ -13,3 +13,85 @@
13
13
  ご存知の方いらっしゃいましたら、ご教授ください。
14
14
 
15
15
  お願いいたします。
16
+
17
+
18
+
19
+ ```
20
+
21
+ public Workbook excelRead(String excelPath) {
22
+
23
+ FileInputStream is =null;
24
+
25
+ Workbook wb = null;
26
+
27
+ try {
28
+
29
+ is = new FileInputStream(excelPath);
30
+
31
+ wb =WorkbookFactory.create(is);
32
+
33
+
34
+
35
+ } catch (FileNotFoundException e) {
36
+
37
+ e.printStackTrace();
38
+
39
+ } catch (EncryptedDocumentException e) {
40
+
41
+ e.printStackTrace();
42
+
43
+ } catch (InvalidFormatException e) {
44
+
45
+ e.printStackTrace();
46
+
47
+ } catch (IOException e) {
48
+
49
+ e.printStackTrace();
50
+
51
+ }finally{
52
+
53
+ try {
54
+
55
+ is.close();
56
+
57
+ } catch (IOException e) {
58
+
59
+ e.printStackTrace();
60
+
61
+ }
62
+
63
+ }
64
+
65
+
66
+
67
+ return wb;
68
+
69
+
70
+
71
+ }
72
+
73
+
74
+
75
+ java.io.FileNotFoundException: "C:\aaa\bbb\test.xls" (ファイル名、ディレクトリ名、またはボリューム ラベルの構文が間違っています。)
76
+
77
+ at java.io.FileInputStream.open0(Native Method)
78
+
79
+ at java.io.FileInputStream.open(FileInputStream.java:195)
80
+
81
+ at java.io.FileInputStream.<init>(FileInputStream.java:138)
82
+
83
+ at java.io.FileInputStream.<init>(FileInputStream.java:93)
84
+
85
+ at knowledge.ExcelOpe.excelRead(ExcelOpe.java:34)
86
+
87
+ at PCkanriweekly.WeeklyCheck.main(WeeklyCheck.java:84)
88
+
89
+ Exception in thread "main" java.lang.NullPointerException
90
+
91
+ at knowledge.ExcelOpe.excelRead(ExcelOpe.java:47)
92
+
93
+ at PCkanriweekly.WeeklyCheck.main(WeeklyCheck.java:84)
94
+
95
+
96
+
97
+ ```