本文介绍了Java的POI的ClassNotFoundException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试使用POI类从Apache到一个dovx转换为txt。我包括了所有的拉链有罐子,但我得到这个错误:
05-21 21:32:04.508:E / dalvikvm(1977):找不到类的org.apache.poi.xwpf.usermodel.XWPFDocument,从法com.example.flashcards.WordToTxt.convert引用
05-21 21:32:04.508:E / AndroidRuntime(1977年):致命异常:主要
05-21 21:32:04.508:E / AndroidRuntime(1977):java.lang.NoClassDefFoundError的:org.apache.poi.xwpf.usermodel.XWPFDocument
05-21 21:32:04.508:E / AndroidRuntime(1977):在com.example.flashcards.WordToTxt.convert(WordToTxt.java:16)
05-21 21:32:04.508:E / AndroidRuntime(1977):在com.example.flashcards.MainActivity.onCreate(MainActivity.java:65)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.app.ActivityThread.access $ 1500(ActivityThread.java:117)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.app.ActivityThread $ H.handleMessage(ActivityThread.java:931)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.os.Handler.dispatchMessage(Handler.java:99)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.os.Looper.loop(Looper.java:130)
05-21 21:32:04.508:E / AndroidRuntime(1977):在android.app.ActivityThread.main(ActivityThread.java:3683)
05-21 21:32:04.508:E / AndroidRuntime(1977):在java.lang.reflect.Method.invokeNative(本机方法)
05-21 21:32:04.508:E / AndroidRuntime(1977):在java.lang.reflect.Method.invoke(Method.java:507)
05-21 21:32:04.508:E / AndroidRuntime(1977):在com.android.internal.os.ZygoteInit $ MethodAndArgsCaller.run(ZygoteInit.java:839)
05-21 21:32:04.508:E / AndroidRuntime(1977):在com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
05-21 21:32:04.508:E / AndroidRuntime(1977):在dalvik.system.NativeStart.main(本机方法)
和我包括罐子是:
POI-例子
POI-excelant
POI-OOXML
POI暂存器DOM4J
STAX的API
XMLBeans的
为什么没有发现?类非常感谢
现在我已经依赖这些罐子(在Eclipse)
26/11/2012 16:22 1.869.113 POI-3.9-20121203.jar
26/11/2012 16:22 309.368 POI-例子,3.9-20121203.jar
26/11/2012 16:22 30.446 POI-excelant-3.9-20121203.jar
26/11/2012 16:22 936.648 POI-OOXML-3.9-20121203.jar
26/11/2012 16:22 4.802.621 POI-OOXML-架构 - 3.9-20121203.jar
26/11/2012 16:22 1.226.511 POI暂存器,3.9-20121203.jar14/05/2011 09:51 73.098 commons- codeC-1.5.jar
18/09/2009 15:17 52.915的commons-logging-1.1.jar
2009/05/04 12:24 121.070的junit-3.8.1.jar
2009/05/04 12:24 358.180的log4j-1.2.13.jar2009/05/04 12:28 313.898的dom4j-1.6.1.jar
23/02/2011 11:31 26.514 StAX的API-1.0.1.jar
2009/05/04 12:29 2.666.695的xmlbeans-2.3.0.jar
解决方案
看起来你是缺少几个罐子的。
您需要:
POI-版本yyyymmdd.jar
公共-logging.jar的
commons- codec.jar
log4j.jar
POI-OOXML-架构版本,yyyymmdd.jar
xmlbeans.jar
STAX-API-1.0.1.jar
dom4j.jar
im trying to use the POI classes from apache to convert a dovx to txt. I included all the jars that the zip has, but i get this error:
05-21 21:32:04.508: E/dalvikvm(1977): Could not find class 'org.apache.poi.xwpf.usermodel.XWPFDocument', referenced from method com.example.flashcards.WordToTxt.convert 05-21 21:32:04.508: E/AndroidRuntime(1977): FATAL EXCEPTION: main 05-21 21:32:04.508: E/AndroidRuntime(1977): java.lang.NoClassDefFoundError: org.apache.poi.xwpf.usermodel.XWPFDocument 05-21 21:32:04.508: E/AndroidRuntime(1977): at com.example.flashcards.WordToTxt.convert(WordToTxt.java:16) 05-21 21:32:04.508: E/AndroidRuntime(1977): at com.example.flashcards.MainActivity.onCreate(MainActivity.java:65) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.app.ActivityThread.access$1500(ActivityThread.java:117) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.os.Handler.dispatchMessage(Handler.java:99) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.os.Looper.loop(Looper.java:130) 05-21 21:32:04.508: E/AndroidRuntime(1977): at android.app.ActivityThread.main(ActivityThread.java:3683) 05-21 21:32:04.508: E/AndroidRuntime(1977): at java.lang.reflect.Method.invokeNative(Native Method) 05-21 21:32:04.508: E/AndroidRuntime(1977): at java.lang.reflect.Method.invoke(Method.java:507) 05-21 21:32:04.508: E/AndroidRuntime(1977): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839) 05-21 21:32:04.508: E/AndroidRuntime(1977): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597) 05-21 21:32:04.508: E/AndroidRuntime(1977): at dalvik.system.NativeStart.main(Native Method)
and the jar that i included are:
poi-examples poi-excelant poi-ooxml poi-scratchpad dom4j stax-api xmlbeans
Why is not finding that class?? thanks a lot
Now i've these jars in dependencies (in eclipse)
26/11/2012 16:22 1.869.113 poi-3.9-20121203.jar 26/11/2012 16:22 309.368 poi-examples-3.9-20121203.jar 26/11/2012 16:22 30.446 poi-excelant-3.9-20121203.jar 26/11/2012 16:22 936.648 poi-ooxml-3.9-20121203.jar 26/11/2012 16:22 4.802.621 poi-ooxml-schemas-3.9-20121203.jar 26/11/2012 16:22 1.226.511 poi-scratchpad-3.9-20121203.jar 14/05/2011 09:51 73.098 commons-codec-1.5.jar 18/09/2009 15:17 52.915 commons-logging-1.1.jar 05/04/2009 12:24 121.070 junit-3.8.1.jar 05/04/2009 12:24 358.180 log4j-1.2.13.jar 05/04/2009 12:28 313.898 dom4j-1.6.1.jar 23/02/2011 11:31 26.514 stax-api-1.0.1.jar 05/04/2009 12:29 2.666.695 xmlbeans-2.3.0.jar
解决方案
Looks like you are missing a few jar's.
http://poi.apache.org/overview.html
You need:
poi-version-yyyymmdd.jar
commons-logging.jar
commons-codec.jar
log4j.jar
poi-ooxml-schemas-version-yyyymmdd.jar
xmlbeans.jar
stax-api-1.0.1.jar
dom4j.jar
这篇关于Java的POI的ClassNotFoundException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!