Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Accessing classes from plugin
Accessing classes from plugin [message #528043] Mon, 19 April 2010 06:05 Go to next message
Prasad is currently offline PrasadFriend
Messages: 10
Registered: July 2009
Junior Member
beginner question.
I created a plug-in from existing jar files and installed it.
What do I need to do to access the classes in the jar file(s) that are part of the above plug-in in a class from simple java project?
thanks,
P
Re: Accessing classes from plugin [message #528122 is a reply to message #528043] Mon, 19 April 2010 12:38 Go to previous messageGo to next message
Flavio  Vit is currently offline Flavio VitFriend
Messages: 9
Registered: July 2009
Junior Member
Hi

You need to export the packages you want to make visible to other projects.

Go to the tab Runtime at the plugin.xml and Add the packages you want to make visible.


Flavio ViT
Re: Accessing classes from plugin [message #528180 is a reply to message #528122] Mon, 19 April 2010 15:34 Go to previous messageGo to next message
Prasad is currently offline PrasadFriend
Messages: 10
Registered: July 2009
Junior Member
thanks for the response.
I do have these packages exported as but when I try to do import of any of these packages in the java source, the code completion does not find the packages.

e.g. I can not access com.prasad.myclasses.* in my java code even though I see the plug-in installed. The other packages are the ones consumed by the classes in com.prasad....

I looks like following in manifest.mf
Export-Package:
com.prasad.myclasses
com.prasad.myclasses.utils
....
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.codec.digest,
org.apache.commons.codec.language,
org.apache.commons.codec.net,
org.apache.commons.httpclient,
org.apache.commons.httpclient.auth,
org.apache.commons.httpclient.cookie,
org.apache.commons.httpclient.methods,
org.apache.commons.httpclient.methods.multipart,
org.apache.commons.httpclient.params,
org.apache.commons.httpclient.protocol,
org.apache.commons.httpclient.util,
org.apache.commons.logging,
org.apache.commons.logging.impl,
org.w3._2001.xmlschema

[Updated on: Mon, 19 April 2010 15:42]

Report message to a moderator

Re: Accessing classes from plugin [message #528213 is a reply to message #528180] Mon, 19 April 2010 17:33 Go to previous messageGo to next message
Flavio  Vit is currently offline Flavio VitFriend
Messages: 9
Registered: July 2009
Junior Member
So, you have created a plugin, exported the internal packages and now you are trying to use those into another java project, right?

Have you added the new plugin into the class path of your Java application?

Is your plugin deployed over your Eclipse instalation or is it loaded as a Project into the workbench?
Re: Accessing classes from plugin [message #528223 is a reply to message #528213] Mon, 19 April 2010 18:02 Go to previous messageGo to next message
Prasad is currently offline PrasadFriend
Messages: 10
Registered: July 2009
Junior Member
Flavio Vit wrote on Mon, 19 April 2010 13:33
So, you have created a plugin, exported the internal packages and now you are trying to use those into another java project, right?

Yes, that's right

Have you added the new plugin into the class path of your Java application?
No. DO i have to treat the plug-in jar as external Jar? What if I have a directory and the plug-in is not exported as a single Jar file?

Is your plugin deployed over your Eclipse instalation or is it loaded as a Project into the workbench?


I have a separate eclipse install to test it. I installed the plugin in separate eclipse set up.

thanks for looking into this.
- P
Re: Accessing classes from plugin [message #528227 is a reply to message #528223] Mon, 19 April 2010 18:31 Go to previous messageGo to next message
Flavio  Vit is currently offline Flavio VitFriend
Messages: 9
Registered: July 2009
Junior Member
You need to add to the classpath the new plugin source (as long as it is open in your workspace) or a jar file if it is already deployed.

If as source, right clicking on the Java project -> Properties -> Java Build path -> Projects -> Add, then add the plugin.

[Updated on: Mon, 19 April 2010 18:45]

Report message to a moderator

icon14.gif  Re: Accessing classes from plugin [message #528252 is a reply to message #528227] Mon, 19 April 2010 19:51 Go to previous messageGo to next message
Prasad is currently offline PrasadFriend
Messages: 10
Registered: July 2009
Junior Member
Flavio Vit wrote on Mon, 19 April 2010 14:31
You need to add to the classpath the new plugin source (as long as it is open in your workspace) or a jar file if it is already deployed.

I think adding the individual jar file(s) worked. I was somehow expecting more magical I guess. Not sure what difference it makes to be jar in plug-in other than simply dropping the jar in the project. Definitely update site functionality can be plus. Will spend more time with this.

If as source, right clicking on the Java project -> Properties -> Java Build path -> Projects -> Add, then add the plugin.




Thanks a lot all the help.
Re: Accessing classes from plugin [message #605613 is a reply to message #528122] Mon, 19 April 2010 15:34 Go to previous messageGo to next message
Prasad is currently offline PrasadFriend
Messages: 10
Registered: July 2009
Junior Member
thanks for the response.
I do have these packages exported as but when I try to do import of any of these packages in the java source, the code completion does not find the packages.

e.g. I can not access com.prasad.myclasses.* in my java code even though I see the plug-in installed. The other packages are the ones consumed by the classes in com.prasad....

I looks like following in manifest.mf
Export-Package: com.vmware.vcloud.api.rest.schema,
com.prasad.myclasses
com.prasad.myclasses.utils
....
org.apache.commons.codec,
org.apache.commons.codec.binary,
org.apache.commons.codec.digest,
org.apache.commons.codec.language,
org.apache.commons.codec.net,
org.apache.commons.httpclient,
org.apache.commons.httpclient.auth,
org.apache.commons.httpclient.cookie,
org.apache.commons.httpclient.methods,
org.apache.commons.httpclient.methods.multipart,
org.apache.commons.httpclient.params,
org.apache.commons.httpclient.protocol,
org.apache.commons.httpclient.util,
org.apache.commons.logging,
org.apache.commons.logging.impl,
org.w3._2001.xmlschema
Re: Accessing classes from plugin [message #605618 is a reply to message #605613] Mon, 19 April 2010 17:33 Go to previous messageGo to next message
Flavio  Vit is currently offline Flavio VitFriend
Messages: 9
Registered: July 2009
Junior Member
So, you have created a plugin, exported the internal packages and now you are trying to use those into another java project, right?

Have you added the new plugin into the class path of your Java application?

Is your plugin deployed over your Eclipse instalation or is it loaded as a Project into the workbench?
Re: Accessing classes from plugin [message #605620 is a reply to message #605618] Mon, 19 April 2010 18:02 Go to previous messageGo to next message
Prasad is currently offline PrasadFriend
Messages: 10
Registered: July 2009
Junior Member
Flavio Vit wrote on Mon, 19 April 2010 13:33
> So, you have created a plugin, exported the internal packages and now you are trying to use those into another java project, right?
>
> Yes, that's right
>
> Have you added the new plugin into the class path of your Java application?
> No. DO i have to treat the plug-in jar as external Jar? What if I have a directory and the plug-in is not exported as a single Jar file?
>
> Is your plugin deployed over your Eclipse instalation or is it loaded as a Project into the workbench?


I have a separate eclipse install to test it. I installed the plugin in separate eclipse set up.

thanks for looking into this.
- P
Re: Accessing classes from plugin [message #605621 is a reply to message #605620] Mon, 19 April 2010 18:31 Go to previous messageGo to next message
Flavio  Vit is currently offline Flavio VitFriend
Messages: 9
Registered: July 2009
Junior Member
You need to add to the classpath the new plugin source (as long as it is open in your workspace) or a jar file if it is already deployed.

If as source, right clicking on the Java project -> Properties -> Java Build path -> Projects -> Add, the add the plugin.
Re: Accessing classes from plugin [message #605623 is a reply to message #605621] Mon, 19 April 2010 19:51 Go to previous message
Prasad is currently offline PrasadFriend
Messages: 10
Registered: July 2009
Junior Member
Flavio Vit wrote on Mon, 19 April 2010 14:31
> You need to add to the classpath the new plugin source (as long as it is open in your workspace) or a jar file if it is already deployed.
>
> I think adding the individual jar file(s) worked. I was somehow expecting more magical I guess. Not sure what difference it makes to be jar in plug-in other than simply dropping the jar in the project. Definitely update site functionality can be plus. Will spend more time with this.
>
> If as source, right clicking on the Java project -> Properties -> Java Build path -> Projects -> Add, then add the plugin.


Thanks a lot all the help.
Previous Topic:How to automate converting JAR + Source Zip to p2 repository with plugin + source attachment
Next Topic:Building an Eclipse Plugin (depending on another Eclipse Plugin) using Maven
Goto Forum:
  


Current Time: Tue Mar 19 04:18:07 GMT 2024

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

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

Back to the top