Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » How to access packages of plugins from java project
How to access packages of plugins from java project [message #1164198] Thu, 31 October 2013 14:00 Go to next message
Till Fischer is currently offline Till Fischer
Messages: 57
Registered: August 2012
Member
Hi!

I created an eclipse plugin "my.example.plugin" which runs well. The plugin contains a class "MyClass" in some package "my.example.plugin.package".

Now my problem: I'd like to access/use "MyClass" from a regular java project in another Eclipse instance (which of course has "my.example.plugin" installed). I first thought everything I would need to do was adding "my.example.plugin.package" to the list of exported packages of "my.example.plugin". Unfortunately this doesn't work.

What I can do is converting the java project into a plugin project. In this case eclipse extends the classpath corresponding to "required plugins" as defined in the MANIFEST.MF file. Then I can select "my.example.plugin" as required plugin and use any exported packages. But I'd like to stay with a regular java project (don't want MANIFEST.MF, plugins.xml etc. files). Isn't there any equivalent mechanism to add jars of installed plugins to the classpath? Of course I could add it as "external jar" but this wouldn't be a nice solution at all!

in other words: I'd like to ship a java library together with my plugin.

[Updated on: Thu, 31 October 2013 15:11]

Report message to a moderator

Re: How to access packages of plugins from java project [message #1171738 is a reply to message #1164198] Tue, 05 November 2013 12:50 Go to previous message
Mickael Istria is currently offline Mickael Istria
Messages: 755
Registered: July 2009
Location: Grenoble, France
Senior Member
> What I can do is converting the java project into a plugin project. In
> this case eclipse extends the classpath corresponding to "required
> plugins" as defined in the MANIFEST.MF file. Then I can select
> "my.example.plugin" as required plugin and use any exported packages.

That's indeed the cleanest approach

> But I'd like to stay with a regular java project (don't want
> MANIFEST.MF, plugins.xml etc. files). Isn't there any equivalent
> mechanism to add jars of installed plugins to the classpath? Of course I
> could add it as "external jar" but this wouldn't be a nice solution at all!

Your Java project should reference directly (in its classpath) the jar'd
plugin.
Beware that if you original plugin uses plugin.xml and other
Eclipse-specific stuff, it may not work correctly in a plain JVM out of
the Eclipse platform.

--
Mickael Istria
My job: http://www.jboss.org/tools
My blog: http://mickaelistria.wordpress.com
My Tweets: http://twitter.com/mickaelistria
Previous Topic:Setting dialog attributes for new Launch Configuration Type
Next Topic:Octal Color Picker
Goto Forum:
  


Current Time: Mon Sep 22 08:23:02 GMT 2014

Powered by FUDForum. Page generated in 0.02034 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software