Home » Eclipse Projects » Eclipse Platform » Packaging 3rd party jars as plug-ins
|
Re: Packaging 3rd party jars as plug-ins [message #336156 is a reply to message #336155] |
Wed, 27 May 2009 14:04 |
Dann Martens Messages: 65 Registered: July 2009 |
Member |
|
|
Hi George,
I think you're mixing different things up, here!
The 'Imported Packages' list area in the 'Dependencies' tabs does not
show Java archives, but Java packages. That area is particularly
relevant for OSGi applications, for which it is advocated to declare
dependencies by specifying the packages, *instead* of the actual bundles
which have these packages on their plug-in classpath.
The only way you can 'make public' the Java classes in the .jar of your
project 'tryxml' is to go to the 'Runtime' tab in the Manifest editor
belonging to your 'tryxml' project. There you can add 'Exported
Packages', i.e. the packages visible on the classpath of your 'tryxml'
plug-in, either straight from inside the plug-in, or from .jars
contained in that plug-in.
Mind you, if the 'Classpath' in the 'Runtime' tab is not specified
correctly, you'll have difficulties adding 'Exported Packages'. In
'tryxml' that 'Classpath' list area should at least contain the original
..jar (and/or . (dot) if you have classes available directly on the root
of your plug-in).
Best regards,
Dann
George Murphy wrote:
> Hello Guys,
>
> I am very very sorry if here is the wrong place to post this
> question, else show me the right place to post it.
>
> I am new in Eclipse plugin development. I have develop a plugin and my
> plugin requires other .jar files to work.
>
> I have read that plugins can only use .jar files in other plugins. For
> that reason i searched the web and read the following articles from
> these sites:
>
> http://www.eclipsezone.com/eclipse/forums/t54726.html
>
> http://eclipsewiki.editme.com/PDEFaq (The third sub-heading: How do I
> add a third-party JAR to a plugin classpath?)
>
> I have tried both ways but it seems it is still not working.
>
> This is how i did it:
>
> 1)
> I have my original project in the workspace with name "com.proj.company"
>
> 2)
> I created another project with name "tryxml" according to what the links
> above suggests
>
> 3)
> I go to the "Dependencies" tab of my original project (com.proj.comp)
> and add the "tryxml" project to the required plug-ins.
>
> 4)
> After that in the same tab, i go to the imported packages part and click
> on the "add..." button but i can't see the .jar files(the .jar files i
> created plugin from in the "tryxml" project) in the list, to be able to
> add them to the imported packages.
>
>
> I don't really know what am doing wrong here.
>
>
> Can someone help me to give me a step by step way of achieving it. I
> need a step by step way or a pointer to a tutorial which can give me a
> step by step way of making it work.
> The whole question is am developing a plugin and my plugin needs other
> jar files to be able to work. So kindly tell me what to do so that after
> i compile the original project and get a new instance of eclipse the
> pluing will work.
>
> Thank you very much.
>
|
|
|
exporting jars within jars [message #336157 is a reply to message #336155] |
Wed, 27 May 2009 14:27 |
Eclipse User |
|
|
|
Originally posted by: faraz.fallahi.googlemail.com
Hi.
I need to export my Eclipse Java project as a jar and I want to include
the referenced libraries. Ive read that eclipse doesnt support this. But
today i found a post that says eclipse 3.5 is able to do this. if so,how
does it work. ive tried eclipse 3.5 and the steps for exporting a java
project as a jar seem to be similarto prior versions.
Does anybody know anything about this ?
greez
|
|
|
Re: Packaging 3rd party jars as plug-ins [message #336158 is a reply to message #336156] |
Wed, 27 May 2009 14:39 |
Kap Pak Messages: 52 Registered: July 2009 |
Member |
|
|
Thanks for your reply. Its true that am mixing different things.
I created the 'tryxml' poject using the wizard "create plugin from
existing jar files".
Wel in the classpath i have the ' "." library' but when i try to add the
original .jar files from which i created the project/plugin, i see 2
folders(META-INF and org), i don't see the .jar files from which i created
the plugin. When i navigate through the META-INF folder, i see the name of
the jar files but in a folder form and wen i add them and try to update
the classpath, i get an error that it cannot be nested in the
project/plugin.
I don't know if am doing what you are telling me.
Dan wrote,
I think you're mixing different things up, here!
The 'Imported Packages' list area in the 'Dependencies' tabs does not show
Java archives, but Java packages. That area is particularly relevant for
OSGi applications, for which it is advocated to declare dependencies by
specifying the packages, *instead* of the actual bundles which have these
packages on their plug-in classpath.
The only way you can 'make public' the Java classes in the .jar of your
project 'tryxml' is to go to the 'Runtime' tab in the Manifest editor
belonging to your 'tryxml' project. There you can add 'Exported Packages',
i.e. the packages visible on the classpath of your 'tryxml' plug-in,
either straight from inside the plug-in, or from .jars contained in that
plug-in.
Mind you, if the 'Classpath' in the 'Runtime' tab is not specified
correctly, you'll have difficulties adding 'Exported Packages'. In
'tryxml' that 'Classpath' list area should at least contain the original
..jar (and/or . (dot) if you have classes available directly on the root
of your plug-in).
Best regards,
Dann
|
|
|
Re: Packaging 3rd party jars as plug-ins [message #336159 is a reply to message #336158] |
Wed, 27 May 2009 14:49 |
Dann Martens Messages: 65 Registered: July 2009 |
Member |
|
|
Hi George,
The wizard should have configured everything properly.
Could you repeat the procedure and take special care to the settings in
the 'New Plug-in from Existing JAR Archives': there is a checkbox which
enables 'Unzip the JAR archives into the project'.
If that option is enabled, the classes will be available straight from
inside the plug-in, and in that case the classpath will need to include '.'.
If that option is disabled, which is often a good idea, the jar will be
copied into the root of the project, and the .jar will be mentioned in
the 'Classpath' list area.
Regardless of that option, the 'Exported Packages' should have been
populated with all the packages originally contained in the source .jar.
Can you check this?
Best regards,
Dann
George Murphy wrote:
>
> Thanks for your reply. Its true that am mixing different things.
> I created the 'tryxml' poject using the wizard "create plugin from
> existing jar files".
>
> Wel in the classpath i have the ' "." library' but when i try to add the
> original .jar files from which i created the project/plugin, i see 2
> folders(META-INF and org), i don't see the .jar files from which i
> created the plugin. When i navigate through the META-INF folder, i see
> the name of the jar files but in a folder form and wen i add them and
> try to update the classpath, i get an error that it cannot be nested in
> the project/plugin.
>
> I don't know if am doing what you are telling me.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> Dan wrote,
>
> I think you're mixing different things up, here!
>
> The 'Imported Packages' list area in the 'Dependencies' tabs does not
> show Java archives, but Java packages. That area is particularly
> relevant for OSGi applications, for which it is advocated to declare
> dependencies by specifying the packages, *instead* of the actual bundles
> which have these packages on their plug-in classpath.
>
> The only way you can 'make public' the Java classes in the .jar of your
> project 'tryxml' is to go to the 'Runtime' tab in the Manifest editor
> belonging to your 'tryxml' project. There you can add 'Exported
> Packages', i.e. the packages visible on the classpath of your 'tryxml'
> plug-in, either straight from inside the plug-in, or from .jars
> contained in that plug-in.
>
> Mind you, if the 'Classpath' in the 'Runtime' tab is not specified
> correctly, you'll have difficulties adding 'Exported Packages'. In
> 'tryxml' that 'Classpath' list area should at least contain the original
> .jar (and/or . (dot) if you have classes available directly on the root
> of your plug-in).
>
> Best regards,
> Dann
>
>
>
|
|
| |
Re: Packaging 3rd party jars as plug-ins [message #336161 is a reply to message #336159] |
Wed, 27 May 2009 15:34 |
Kap Pak Messages: 52 Registered: July 2009 |
Member |
|
|
Thanks :
1)
I have repeated the steps and i see the packages in the .files in the
"Exported packages" area and also the jar files appear at the classpath
area of the "Runtime" tab.
Do i have to do anything again, may be in the "Build" tab or in another
tab.
2)
When am running the application i open the "run Cnfiguration" window and
in the plugin tab i make sure 'tryxml' plugin is also checked. After i run
it, i try to open some views which i have created in the application but i
get error that says:
"Could not create the view: Plug-in was unable to load class"
The class of the view is there in my main application but it seems the
'tryxml' manifest file hides the manifest file of the main application
which am running.
Any Help?
Thanks.
Dan wrote:
The wizard should have configured everything properly.
Could you repeat the procedure and take special care to the settings in
the 'New Plug-in from Existing JAR Archives': there is a checkbox which
enables 'Unzip the JAR archives into the project'.
If that option is enabled, the classes will be available straight from
inside the plug-in, and in that case the classpath will need to include
'.'.
If that option is disabled, which is often a good idea, the jar will be
copied into the root of the project, and the .jar will be mentioned in the
'Classpath' list area.
Regardless of that option, the 'Exported Packages' should have been
populated with all the packages originally contained in the source .jar.
Can you check this?
Best regards,
Dann
|
|
| |
Re: Packaging 3rd party jars as plug-ins [message #336174 is a reply to message #336155] |
Wed, 27 May 2009 20:00 |
Eclipse User |
|
|
|
Originally posted by: eclipse-news.rizzoweb.com
George Murphy wrote:
> Hello Guys,
>
> I am very very sorry if here is the wrong place to post this
> question, else show me the right place to post it.
>
> I am new in Eclipse plugin development. I have develop a plugin and my
> plugin requires other .jar files to work.
>
> I have read that plugins can only use .jar files in other plugins.
That is not really accurate. A plug-in can contain JAR files and use the
classes from that JAR; you do not have to put the JAR into a separate
plug-in (although in some circumstances that is the better design).
Here are the steps:
1) In your plug-in project, create a lib/ directory and put the JAR(s)
in it (you can call it anything you want, not just "lib").
2) Open the manifest.mf for your plug-in, go to the Runtime tab.
3) In the Classpath section, use the Add... button to select the JAR(s)
from the lib/ directory in step 1).
4) On the Build tab of the manifest editor, make sure the lib/ directory
is "checked" in the Binary Build section (this ensures that the JAR(s)
are included when you build/export your plug-in).
5) Save the manifest, which will trigger a re-build of your plug-in.
Hope this helps,
Eric
|
|
|
Goto Forum:
Current Time: Thu Dec 26 14:30:26 GMT 2024
Powered by FUDForum. Page generated in 0.03247 seconds
|