我写了一个从excel读取文本的Java程序。所以我导入了一些像这样的jar:,poi-3.10-beta2-20130904.jar
等poi-ooxml-3.10-beta2-20130904.jar
,我可以在eclipse中正确运行程序。但是当我用maven将该程序打包到目录(C:\workspace2\change\bin
)时,
然后我用这样的命令运行这个程序:
C:\workspace2\change\bin>java GenerateVar
它发生此错误:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Cell
at GenerateVar.execute(GenerateVar.java:59)
at GenerateVar.main(GenerateVar.java:25)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Cell
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more