poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jon Svede <jsv...@yahoo.com>
Subject Re: Unable to use POI HSSF in plugin development
Date Tue, 07 Jun 2011 14:14:44 GMT
Swaraj - 

I've cc'd the POI users e-mail list just to close the loop on your thread.

Here is what you should do:

1. in the project explorer, right click and goto New > Project > Other.  Go down 
to Plug-in Development and select "Plug-in from existing JAR archives". Click 
"Next".

2. On the next page click on the "Add External..." button and select your jars.  
If you are only using the HSSF stuff, I think you'll only need the main the POI 
jar (poi-3.7-20101029.jar) but someone else can correct me on that if I am 
wrong.  You can add as many jars as you need here.  Click "Next".  As an aside, 
keep in mind that when creating a plug-in it might be easier for you down the 
road to include all the other jars as well, since you may find that you need to 
support both .xls and .xlsx. 


3. Give the project a name.  I used to name things like this as their literal 
name, so in the case I would have done 'org.apache.poi' but now I find this 
confusing - ASF did not produce the plugin so it's misleading (or at least I 
think it is).  Now I make plug-ins like this com.mycompany.apache.poi - at least 
to me it's clearer - the name of the project is your choice do what makes sense 
to you.  An example of how it can be confusing is logging - if you create your 
own plug-in from commons logging you'll find that it conflicts commons logging 
plugins in the platform.

4. Versioning is the same thing - you can do 3.7.0 to match the POI library 
version or 1.0.0 to specify that it's your first version.  I tend to go with the 
version of the library rather than the 1.0.0 thing.

5. Fill in the plug-in name, and provider, these are strings of whatever you 
want (so in your case it would be Apache POI for the name and your company or 
organization name).

6. Move lower down in this page and uncheck the box that says "Unzip the jar 
archives into this project" - it makes the wizard faster and I have yet to see 
any difference in doing it one way or another.

7. Click "Finish". You're almost done.

8. Open the project and go to the META-INF directory and open the MANIFEST.MF 
file.  Go to the Runtime tab and make sure that there are packages in the list 
of "Exported Packages".  This is important because if there is nothing here, 
your plugin isn't going to work since nothing is exposed.

9. Lastly, go to your project, open the META-INF/MANIFEST.MF and click on the 
Dependencies tab.  Click on 'Add', start typing the name of your new POI 
plug-in, select it and click 'Ok'.

You should be able to import classes in your plugin and run tests as a plug-in 
test.

Also, if you did add things to the build path, remove them, that is not the way 
plugin dependencies are expressed.

I should probably turn this into a blog post; if I do I will let you know.

HTH,

Jon







________________________________
From: "swaraj.bhat@igatepatni.com" <swaraj.bhat@igatepatni.com>
To: jsvede@yahoo.com
Sent: Mon, June 6, 2011 11:34:32 PM
Subject: Re: Unable to use POI HSSF in plugin development

Hi Jon, 

Thanks for the tip..Yes I do mean Eclipse Plug-in. 

Could you kindly tell me how do I make the POI libraries into a plug-in and 
where do I export the packages for that plugin? I have downloaded the 
poi-3.7.20101029.jar file that contains the HSSF libraries and other POI 
libraries. 


Thanks & Regards... 

Swaraj


<quote author='Jon Svede'>
When you say "plug-in" do you mean Eclipse plug-in?

If so this might be better suited to the Eclipse forums....however.....if
you 
mean an Eclipse plug-in: when you say it is on the build path, do you mean
as in 
right clicking on the project and adding it to the build path?  That doesn't 
work in Eclipse plug-ins.  You need to make the POI libraries into a
plug-in, 
export the packages for that plug-in, then add the dependency in your
plug-in.  
Again, I am assuming you mean an Eclipse plug-in.  If not, disregard.

Jon





________________________________
From: swarajbhat <swaraj.bhat@igatepatni.com>
To: user@poi.apache.org
Sent: Fri, June 3, 2011 12:17:26 AM
Subject: Unable to use POI HSSF in plugin development

Hello,

I am developing a plugin to create and perform operations on excel files and
I am not able to use the HSSF library for the same. When I tried using the
HSSF library in an independent java application, the thing worked. But when
I tried using the same during developing the plugin, I get a ClassNotFound
exception for the HSSFWorkbook class. I have added the POI plugin in the
build path (and confirmed that the plugin contains the HSSFWorkbook class)
as well as imported the HSSFWorkbook class. 

Could someone tell me what I am doing wrong here? Is there something else I
need to add or modify while using the POI library in plugin development? Or
is it just my bad luck that its not working!!! 

Thanks and Regards...

--
View this message in context: 
http://apache-poi.1045710.n5.nabble.com/Unable-to-use-POI-HSSF-in-plugin-development-tp4450274p4450274.html


Sent from the POI - User mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
</quote>
Quoted from: 
http://apache-poi.1045710.n5.nabble.com/Unable-to-use-POI-HSSF-in-plugin-development-tp4450274p4451829.html
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message