java


java.lang.NoClassDefFoundError, but all jar files are in place


SOLVED, I GOT IT TO WORK
I just completed my first real JAVA program. It is a program which lets you open a .xlsx file and the program extracts data from this file and shows this in a textArea.
In eclipse, the program works totally fine, but the exported jar doesn't. Once the project is exported I open it in CMD with java -jar c://...... and it opens just fine. However when I try to open the excel file I get this error:
Error message
So basically one of the needed .jar files seems not to be available in runtime. However I believe all of the needed poi-3.9 and xmlbeans are available. See this:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry exported="true" kind="lib" path="src/xmlbeans-2.3.0.jar"/>
<classpathentry exported="true" kind="lib" path="src/poi-3.9-20121203.jar"/>
<classpathentry exported="true" kind="lib" path="src/poi-examples-3.9-20121203.jar"/>
<classpathentry exported="true" kind="lib" path="src/poi-excelant-3.9-20121203.jar"/>
<classpathentry exported="true" kind="lib" path="src/poi-ooxml-3.9-20121203.jar"/>
<classpathentry exported="true" kind="lib" path="src/poi-ooxml-schemas-3.9-20121203.jar"/>
<classpathentry exported="true" kind="lib" path="src/poi-scratchpad-3.9-20121203.jar"/>
<classpathentry exported="true" kind="lib" path="src/log4j-1.2.13.jar"/>
<classpathentry exported="true" kind="lib" path="src/junit-3.8.1.jar"/>
<classpathentry exported="true" kind="lib" path="src/commons-logging-1.1.jar"/>
<classpathentry exported="true" kind="lib" path="commons-collections4-4.1-javadoc.jar"/>
<classpathentry exported="true" kind="lib" path="commons-collections4-4.1.jar"/>
<classpathentry exported="true" kind="lib" path="src/commons-codec-1.5.jar"/>
<classpathentry exported="true" kind="lib" path="poi-ooxml-3.9.jar"/>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry exported="true" kind="lib" path="lib/commons-codec-1.10.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-io-2.5.jar"/>
<classpathentry exported="true" kind="lib" path="lib/commons-lang3-3.4.jar"/>
<classpathentry kind="lib" path="lib/commons-logging-1.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/cssparser-0.9.20.jar"/>
<classpathentry exported="true" kind="lib" path="lib/htmlunit-2.23.jar"/>
<classpathentry exported="true" kind="lib" path="lib/htmlunit-core-js-2.23.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpclient-4.5.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpcore-4.4.4.jar"/>
<classpathentry exported="true" kind="lib" path="lib/httpmime-4.5.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jetty-io-9.2.18.v20160721.jar"/>
<classpathentry exported="true" kind="lib" path="lib/jetty-util-9.2.18.v20160721.jar"/>
<classpathentry exported="true" kind="lib" path="lib/neko-htmlunit-2.23.jar"/>
<classpathentry exported="true" kind="lib" path="lib/sac-1.3.jar"/>
<classpathentry exported="true" kind="lib" path="lib/serializer-2.7.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/websocket-api-9.2.18.v20160721.jar"/>
<classpathentry exported="true" kind="lib" path="lib/websocket-client-9.2.18.v20160721.jar"/>
<classpathentry exported="true" kind="lib" path="lib/websocket-common-9.2.18.v20160721.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xalan-2.7.2.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xercesImpl-2.11.0.jar"/>
<classpathentry exported="true" kind="lib" path="lib/xml-apis-1.4.01.jar"/>
<classpathentry exported="true" kind="lib" path="src/jsoup-1.10.1.jar"/>
<classpathentry exported="true" kind="lib" path="src/dom4j-1.6.1.jar"/>
<classpathentry exported="true" kind="lib" path="src/selenium-server-standalone-3.0.1.jar"/>
<classpathentry exported="true" kind="lib" path="src/stax-api-1.0.1.jar"/>
<classpathentry kind="lib" path="src/poi-ooxml-3.11.jar"/>
<classpathentry exported="true" kind="lib" path="src/xbean-2.0.0.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
See also my Order and Exporttab in the build path configurations.
Export
Am I missing something? Any help is greatly appreciated!
EDIT:
I made some changes and all necessary jars are in the lib/ folder of my project. If I export jar and view the jar contents with: jar tf "location.jar". I get the following. So I believe this means that everything is exported nicely. Any suggestions on what might be going wrong, because i keep getting the same error.
This is because eclipse reads your class-path dependencies and includes them in the runtime but for running the exported jar through the java -jar command, you will have to add the -cp <your-jar-locations-semicolon-separated> so that jvm knows that the jars are to be included in the class-path while execution.
alternatively, look into building a shaded jar which contains all your dependent jars in the exported jar.

Related Links

Connection to two different databases in single class
inserting existing PDF into one being created, iText 2
How to check if an argument is pointing to the right field in Java
How do you set a TextView of a fragment in a ViewPager from the MainActivity?
Junit test method returning statement “void type no allowed”
Spring MVC Hibernate session error [duplicate]
Java programming - Abstract class
Replacing group of characters using regular expression in Java
How define Structural Type that the method return this
How come my Applet isn't displaying my panels, buttons, textfields, and text areas?
The import org.apache.solr.core.CoreContainer.Initializer cannot be resolved in solr search
Reading output of a C++ DLL using JNA
Weblogic stuck thread in JAX-WS Client
NullPointerException when using Struts fileuploading [duplicate]
How to remove the selected item from Arraylist<HashMap<String, String>> in android
Reading in from a text file, with character limit

Categories

HOME
jdo
deployment
hook
deezer
path-finding
plone
fme
read-eval-print-loop
at-command
setup-deployment
ip
umd
installshield
opengl-es-2.0
medical
adobe-analytics
floating-action-button
php-7.1
commonmark
caml
after-effects
footer
visual-composer
custom-wordpress-pages
cultureinfo
jndi
wijmo
angular2-aot
bootstrap-material-design
publish
buck
jspm
preg-match
javascriptcore
data-manipulation
http-get
google-api-nodejs-client
mapdb
webix-treetable
uft-api
temporary-files
squib
node-gyp
import-from-excel
checkboxlist
modelmapper
eclipse-gef
segment
angular-resource
chain-builder
pebble-watch
svmlight
elgg
media-player
namecoin
pdfclown
topbeat
specrun
pintos
time-and-attendance
azure-virtual-network
merge-conflict-resolution
paypal-express
clang-static-analyzer
markojs
simplewebrtc
make-install
oauth2client
pervasive-sql
rtbkit
npapi
network-interface
mdt
php-5.4
project-planning
phpthumb
datagridviewcolumn
balanced-payments
html5-notifications
floating-point-precision
ora-00911
distutils
angularjs-controller
tridion-worldserver
uiviewanimation-curve
enter
gnu-prolog
subgurim-maps
infobox
xmlspy
recent-documents
android-sdk-2.1
mongomapper
floating
getresponsestream
castle-monorail
fixed-width
project-hosting
defensive-programming
geneva-server
.net-1.0

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App