Nicolas400
Nicolas400

Reputation: 85

how to add poi library to eclipse rcp project?

i'm trying to debug/run my app with poi libraries.

I added jar files downloaded from POI Official Site, and I put it in lib folder. I also configure build path and add manually each one of the jar files.

This are the libraries ...

enter image description here

NOTE: In my libraries I allready have poi-3.0.1-FINAL.jar.

When I edit the class, i have no errors. but when I run or debug app, i get this in console:

java.version=1.6.0_45 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=es_AR Framework arguments: -product AgroTracker.product Command-line arguments: -product AgroTracker.product -data C:\Users\Nico\AgroTrackerWrkSpace/../runtime-AgroTracker.product -dev file:C:/Users/Nico/AgroTrackerWrkSpace/.metadata/.plugins/org.eclipse.pde.core/AgroTracker.product/dev.properties -os win32 -ws win32 -arch x86 -consoleLog

!ENTRY org.eclipse.ui 4 0 2017-06-28 08:12:55.143 !MESSAGE Unhandled event loop exception !STACK 0 java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook at ar.com.cse.cseagro.view.ensayo.CargaEnsayoView$13.widgetSelected(CargaEnsayoView.java:491) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)

Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.Workbook at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417) at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)

What I'm missing to do in eclipse ?

What are the minimum jar files necesary to write and read .XLSX files ?

Best regards!

Binaries !!

POI Binary

Upvotes: 1

Views: 1153

Answers (2)

corporateWhore
corporateWhore

Reputation: 635

Step 1: Download latest version

Step 2: Unzip (unpack) files to what ever directory you want

Step 3: Right-click on you eclipse project in the eclipse package explorer

Step 4: Select Build Path >> Add External Archives...

Step 5: Navigate to the unzipped folder

Step 6: Select all files

Step 7: Click "Open" enter image description here

Step 8: Rejoice

Upvotes: 0

greg-449
greg-449

Reputation: 111141

In a plug-in you must add the library jars to the plug-in's classpath rather than just adding them to the build path.

Open the MANIFEST.MF editor. On the 'Runtime' tab look at the 'Classpath' section. Click Add... and add the jars to the class path. Make sure you do not delete the '.' entry. This will add the jars to the 'Bundle-Classpath' in the MANIFEST.MF

On the 'Build' tab add the jars to the 'Binary Build' list. This will update the 'build.properties' file to make sure the files are included in the plug-in when it is built.

Upvotes: 3

Related Questions