Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Changing the classpath of an exported product
Changing the classpath of an exported product [message #518919] Fri, 05 March 2010 08:05 Go to next message
Roel De Nijs is currently offline Roel De Nijs
Messages: 28
Registered: March 2010
Junior Member
Hi all,

I don't know if this is the most appropriate forum to ask this question, but I'll give it a shot.

When we export our product, we need to add a directory to the classpath. This directory contains some necessary files with configuration settings.
I already tried to add:
-vmargs
-Djava.class.path=path_to_directory

to the command line when starting our application (or to the launcher_name.ini file). But it seems to be ignored completely, because when the java.class.path is printed from out application, it contains only 1 file: app_dir/plugins/org.eclipse.equinox.launcher_1.0.201.R35x_v2 0090715.jar

How can you achieve this (if it is possible of course)?

Kind regards,
Roel
Re: Changing the classpath of an exported product [message #519003 is a reply to message #518919] Fri, 05 March 2010 06:36 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

It might be possible, but is generally hard to do. You could try some
of the osgi classpath options from
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/reference/misc/runtime-options.html
and see if they help.

Of you could pass your config file directory in to your app also through
the .ini or command line arguments.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Changing the classpath of an exported product [message #519183 is a reply to message #518919] Sun, 07 March 2010 15:41 Go to previous messageGo to next message
Roel De Nijs is currently offline Roel De Nijs
Messages: 28
Registered: March 2010
Junior Member
Hi Paul,

Thanks for your answer.

Which osgi classpath options do you mean? Because I had a quick look at the link you mentioned and the only one that mentioned classpath was -dev. I tried that but my application won't start anymore (I'm getting a "can't unzip file" error message)

With your last remark you mention I could pass it to my application as a property in the config file or as a command line argument (like -vmargs -DdirConfigFile=dir_to_config_file). But that's not good enough: we use Spring to create our beans and inject them into our classes, so it has to be on the classpath (otherwise Spring's applicationContext fails to load).

Kind regards,
Roel
Re: Changing the classpath of an exported product [message #519408 is a reply to message #519183] Mon, 08 March 2010 12:56 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

AFAIK there are a set of plugins for spring that aid in using Spring in
eclipse ... I would do a quick google search and follow one of the
suggestions there, as they've already set up the patterns that need to
be followed to use spring and eclipse bundles/plugins successfully.

PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Changing the classpath of an exported product [message #519451 is a reply to message #518919] Mon, 08 March 2010 15:52 Go to previous messageGo to next message
Roel De Nijs is currently offline Roel De Nijs
Messages: 28
Registered: March 2010
Junior Member
Hi Paul,

I guess you are refering to Spring IDE (or the SpringSource Tool Suite). That's what a quick google reveals.

But is installing a "a graphical user interface for the configuration files used by the Spring Framework" not a bit too much? Because we don't have no problems at all with our spring configuration files, we just want to find a way to add some file on the classpath.

When googling around I found this link: http://dev.eclipse.org/newslists/news.eclipse.platform.rcp/m sg15373.html
Could this be a possible work-around? And how/where can I find the command line eclipse uses to execute our product?

Kind regards,
Roel
Re: Changing the classpath of an exported product [message #519725 is a reply to message #519451] Tue, 09 March 2010 09:28 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

Roel De Nijs wrote:
> Hi Paul,
>
> I guess you are refering to Spring IDE (or the SpringSource Tool Suite).
> That's what a quick google reveals.
>
> But is installing a "a graphical user interface for the configuration
> files used by the Spring Framework"

It's not the graphical IDE that I'd be interested in, but the spring
runtime that must be there to correctly use spring in an OSGi bundle
based environment. Do either of those Spring IDEs have examples of
using Spring in an RCP app? Or are they only for regular Java app
development?

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Changing the classpath of an exported product [message #519925 is a reply to message #518919] Wed, 10 March 2010 09:26 Go to previous messageGo to next message
Roel De Nijs is currently offline Roel De Nijs
Messages: 28
Registered: March 2010
Junior Member
You have Spring DM (Spring Dynamic Modules for OSGi Service Platforms project) which makes it easy to build Spring applications that run in an OSGi framework.

Our application has a seperate plugin which has a dependency to the spring.jar and exports all the pacakge. This plugin is referenced by other plugins and all our spring configuration files (in 4-5 other plugins) are loaded fine. If we add our configuration file to one of these plugins, the configuration file is on the classpath and is read without any problem by Spring. So that's working.
And if you google around and look at examples of rcp integration with spring it's always a default configuration (all configuration files and/or other files are part of the plugin) and that's working, but not really useful to solve our issue.

We want to exclude the configuration file from the headless build, so you just have to build 1 application and afterwards you can add the configuration file you want (for test, user acceptance, production,...).
You can definitely argue if this is the best approach possible, but that's the question I was asked (because I'm the RCP guru of the team and all RCP questions are directed my way): how can this configuration file be added to the classpath? And it seems this can't be done through Eclipse.

Kind regards,
Roel
Re: Changing the classpath of an exported product [message #519942 is a reply to message #519925] Wed, 10 March 2010 10:00 Go to previous messageGo to next message
Paul Webster is currently offline Paul Webster
Messages: 6850
Registered: July 2009
Location: Ottawa
Senior Member

You could include an extra plugin that contains only config files, and
exports them so they can be seen.

It could be a Configuration feature (and enjoy all the benefits of p2,
update sites, being upgradable, and installable).

Or you could just make a simple bundle with the configuration files and
put it in the dropins folder.

Would that work? That would make them all OSGi, support versioning and
tooling, etc.

Other than that, in theory you could add your config directory to the
boot class path, that might make them available:
-Xbootclasspath/a:/path/to/config

Later,
PW

--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Changing the classpath of an exported product [message #520478 is a reply to message #519942] Fri, 12 March 2010 09:37 Go to previous message
Roel De Nijs is currently offline Roel De Nijs
Messages: 28
Registered: March 2010
Junior Member
Hi Paul,

I tried 2 of your suggestions:

1/ appending to the boot class path: works just fine. when you start the application and print the system property you can see that the configuration directory is appended to the boot class path. And the config file is found by Spring, so Spring is happy (and I'm happy too)

2/ I tried to use the dropins folder, but that didn't work. I just created a plugin project containing my config file, I exported this plugin (as deployable plugin), added it to the dropins folder, started the application but it is just ignored and so Spring was not happy at all.
I tried to install the WTP project in my eclipse for plugin developers and that worked without any problem. I tried to do the same with our exported product (export the product, move our feature and plugins to the dropin folder), but that won't work (Application "..." could not be found in the registry).

Nonetheless I'm glad it works with the boot class path.

Many thanks for your time and effort!
Kind regards,
Roel
Previous Topic:How can I get the path of the project
Next Topic:Bundle org.eclipse.equinox.launcher.win32.win32.x86_1.0.3.R33x_v20080118 failed to resolve.
Goto Forum:
  


Current Time: Fri Apr 18 01:47:18 EDT 2014

Powered by FUDForum. Page generated in 0.05799 seconds