Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » Access jar file outside plugin directory
Access jar file outside plugin directory [message #206349] Thu, 04 March 2004 22:06 Go to next message
Eclipse UserFriend
I have a standalone Java application that is installed in its own
directory, let's say C:\Program Files\Java\foo.jar. Now I want to create
a simple Eclipse plug-in that adds a menu item to launch the application.
The problem is that I can't just specify foo.jar to be included in the
class path under the "Runtime" tab of the plugin.xml file since foo.jar
doesn't reside in the same directory. So I tried to specify "C:\Program
Files\Java\foo.jar", and it still can't find the main class to call. What
should I do? Thanks!

Regards,
Michael
Re: Access jar file outside plugin directory [message #206554 is a reply to message #206349] Fri, 05 March 2004 10:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NO.SPAM.us.ibm.com

Do you want to launch an application (which means start a new process
and use a main() class in that jar) or do you want to access a class in
the jar from your plugin and run methods against it?

To launch, you use launch configurations. See
http://www.eclipse.org/articles/Article-Java-launch/launchin g-java.html

To access a class in the jar the jar must be in the plugin directory, or
some subdirectory of it and it must be specified as a <library> in the
plugin.xml.

--
Thanks, Rich Kulp

Re: Access jar file outside plugin directory [message #206630 is a reply to message #206554] Fri, 05 March 2004 11:46 Go to previous messageGo to next message
Eclipse UserFriend
My intention was to access the class directly in the jar instead of
starting a seperate VM and wonder if that can be done when the needed jar
is be outside the plugin directory. Thanks for the info!

Michael

Rich Kulp wrote:

> Do you want to launch an application (which means start a new process
> and use a main() class in that jar) or do you want to access a class in
> the jar from your plugin and run methods against it?

> To launch, you use launch configurations. See
> http://www.eclipse.org/articles/Article-Java-launch/launchin g-java.html

> To access a class in the jar the jar must be in the plugin directory, or
> some subdirectory of it and it must be specified as a <library> in the
> plugin.xml.
Re: Access jar file outside plugin directory [message #206866 is a reply to message #206554] Fri, 05 March 2004 20:43 Go to previous messageGo to next message
Eclipse UserFriend
Rich,

So there just isn't a way to add the external jar to the classpath? Like
by modifying the environment variable or a config file or something to set
that classpath when Eclipse first starts? That seems to be quite a
limitation. If someone has an application installed anywhere in the
system and has a config file that tells me where the jar file is, I should
be able to load that jar and call "Foo f = new Foo()" without having to
create a separate Java process. The plugin jar should only deal with the
logic of integration with Eclipse workbench, and the plugin directory
shouldn't need to contain the application jar files. Otherwise, if the
standalone version is updated, my plugin will be out of sync. Creating
symbolic link isn't ideal either.

Launching it by calling main with a separate process denies me tighter
integration with Eclipse. Let say in my standalone application, I have
some pretty cool views, and they are in classes Bar1View.java,
Bar2View.java, Bar3View.java. So I want to put them together in a
Perspective, then I will need to call "new Bar1View()", "new Bar2View()",
etc., but that shouldn't require me to have the jar file that contains
these views in the plugin directory.

Michael


Rich Kulp wrote:

> Do you want to launch an application (which means start a new process
> and use a main() class in that jar) or do you want to access a class in
> the jar from your plugin and run methods against it?

> To launch, you use launch configurations. See
> http://www.eclipse.org/articles/Article-Java-launch/launchin g-java.html

> To access a class in the jar the jar must be in the plugin directory, or
> some subdirectory of it and it must be specified as a <library> in the
> plugin.xml.
Re: Access jar file outside plugin directory [message #206890 is a reply to message #206866] Fri, 05 March 2004 23:03 Go to previous message
Eclipse UserFriend
Originally posted by: ifedorenko.rogers.com

First, there are already two bugreports related to this problem

https://bugs.eclipse.org/bugs/show_bug.cgi?id=3074
https://bugs.eclipse.org/bugs/show_bug.cgi?id=30919

Second, there is a trick/solution that should work with latest 3.0
builds which was suggested on this group few weeks ago. Basically, the
idea is to dynamically install fragment/plugin that will be "located"
together with the external application.


Michael Xia wrote:
> Rich,
>
> So there just isn't a way to add the external jar to the classpath? Like
> by modifying the environment variable or a config file or something to set
> that classpath when Eclipse first starts? That seems to be quite a
> limitation. If someone has an application installed anywhere in the
> system and has a config file that tells me where the jar file is, I should
> be able to load that jar and call "Foo f = new Foo()" without having to
> create a separate Java process. The plugin jar should only deal with the
> logic of integration with Eclipse workbench, and the plugin directory
> shouldn't need to contain the application jar files. Otherwise, if the
> standalone version is updated, my plugin will be out of sync. Creating
> symbolic link isn't ideal either.
>
> Launching it by calling main with a separate process denies me tighter
> integration with Eclipse. Let say in my standalone application, I have
> some pretty cool views, and they are in classes Bar1View.java,
> Bar2View.java, Bar3View.java. So I want to put them together in a
> Perspective, then I will need to call "new Bar1View()", "new Bar2View()",
> etc., but that shouldn't require me to have the jar file that contains
> these views in the plugin directory.
>
> Michael
>
>
> Rich Kulp wrote:
>
>
>>Do you want to launch an application (which means start a new process
>>and use a main() class in that jar) or do you want to access a class in
>>the jar from your plugin and run methods against it?
>
>
>>To launch, you use launch configurations. See
>> http://www.eclipse.org/articles/Article-Java-launch/launchin g-java.html
>
>
>>To access a class in the jar the jar must be in the plugin directory, or
>>some subdirectory of it and it must be specified as a <library> in the
>>plugin.xml.
>
>
>
>
Previous Topic:Popup submenus
Next Topic:Can 2.1.x PDE target eclipse 3.0
Goto Forum:
  


Current Time: Fri Sep 26 07:59:17 EDT 2025

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

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

Back to the top