Home » Eclipse Projects » e(fx)clipse » How to startup efxclipse RCP application via EclipseStarter programmatically?
How to startup efxclipse RCP application via EclipseStarter programmatically? [message #1591203] |
Thu, 29 January 2015 06:31  |
Eclipse User |
|
|
|
I' ve difficulties when trying to startup an exported efxclipse RCP application from within Java via the EclipseStarter. Running it from the command line from the eclipse directory java -jar plugins\org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar works like expected and the UI does show up.
But when trying to run it with the EclipseStarter the UI of the application is not displayed. Comparing the bundle states show that many bundles are in STARTING state instead of ACTIVE state when run with EclipseStarter (see below)
Can this problem be related to the used framework adapter hooks? Are there any special properties I've to set? Should it work at all? Has anybody done this before?
------------------ bundles with different state (not ACTIVE) ---------------------
15 STARTING org.eclipse.core.databinding.observable_1.4.1.v20140210-1835
18 STARTING org.eclipse.core.filesystem_1.4.100.v20140514-1614
20 STARTING org.eclipse.core.resources_3.9.1.v20140825-1431
22 STARTING org.eclipse.e4.core.commands_0.10.2.v20140424-2344
23 STARTING org.eclipse.e4.core.contexts_1.3.100.v20140407-1019
24 STARTING org.eclipse.e4.core.di_1.4.0.v20140414-1837
25 STARTING org.eclipse.e4.core.di.extensions_0.12.0.v20140417-2033
26 STARTING org.eclipse.e4.core.services_1.2.1.v20140808-1251
27 STARTING org.eclipse.e4.ui.di_1.0.0.v20140328-2112
28 STARTING org.eclipse.e4.ui.model.workbench_1.1.0.v20140512-1820
29 STARTING org.eclipse.e4.ui.services_1.1.0.v20140328-1925
30 STARTING org.eclipse.e4.ui.workbench_1.2.1.v20140901-1244
31 STARTING org.eclipse.emf.common_2.10.1.v20140901-1043
33 STARTING org.eclipse.emf.ecore_2.10.1.v20140901-1043
35 STARTING org.eclipse.emf.ecore.xmi_2.10.1.v20140901-1043
46 STARTING org.eclipse.fx.core_1.1.0.201411050703
49 STARTING org.eclipse.fx.core.di.context_1.1.0.201411050703
51 STARTING org.eclipse.fx.javafx_2.2.0.201411050602
52 STARTING org.eclipse.fx.osgi.util_1.1.0.201411050703
53 STARTING org.eclipse.fx.ui.controls_1.1.0.201411050703
55 STARTING org.eclipse.fx.ui.di_1.1.0.201411050703
57 STARTING org.eclipse.fx.ui.keybindings_1.1.0.201411050703
59 STARTING org.eclipse.fx.ui.keybindings.generic_1.1.0.201411050703
61 STARTING org.eclipse.fx.ui.services_1.1.0.201411050703
62 STARTING org.eclipse.fx.ui.theme_1.1.0.201411050703
63 STARTING org.eclipse.fx.ui.workbench.base_1.1.0.201411050703
64 STARTING org.eclipse.fx.ui.workbench.fx_1.1.0.201411050703
66 STARTING org.eclipse.fx.ui.workbench.renderers.fx_1.1.0.201411050703
67 STARTING org.eclipse.fx.ui.workbench.services_1.1.0.201411050703
--------------------------------------------------------------------------------------------------------
|
|
| | |
Re: How to startup efxclipse RCP application via EclipseStarter programmatically? [message #1592719 is a reply to message #1591453] |
Fri, 30 January 2015 02:23   |
Eclipse User |
|
|
|
Thank you Tom for your fast response. Unfortunately neither of your suggested soltions work. I will now take a look at the differences between starting with EclipseStarter and the launcher Main. Do you have any additional suggestions? (see my bootstrapping code below, which is called from the main class constructor
new Thread() {
@Override
public void run() {
initializeEclipseStarter();
String[] equinoxArgs = {"org.osgi.framework.bundle.parent", "ext", "-console", "-consoleLog", "-debug", "debug_options", "-org.osgi.framework.bundle.parent", "ext", "-data", "D:/projects/AutoTest/Keba/_out/eclipse/"};
try {
EclipseStarter.main(equinoxArgs);
} catch (Exception e) {
throw new RuntimeException("Starting OSGI failed!", e);
}
}
}.start();
while (!EclipseStarter.isRunning()) {
Thread.sleep(1000);
}
............
private void initializeEclipseStarter() {
Map<String, String> initProps = new HashMap<String, String>();
initProps.put("osgi.syspath", myExportedApplicationLocation+"plugins");
initProps.put("osgi.install.area", myExportedApplicationLocation);
initProps.put("org.osgi.framework.bundle.parent", "ext");
EclipseStarter.setInitialProperties(initProps);
}
[Updated on: Fri, 30 January 2015 02:24] by Moderator
|
|
| |
Re: How to startup efxclipse RCP application via EclipseStarter programmatically? [message #1592739 is a reply to message #1592719] |
Fri, 30 January 2015 02:38   |
Eclipse User |
|
|
|
You are using it wrong! -D needs to be passed to the launch process!
so you should launch the VM with
java -jar .... -Dorg.osgi.framework.bundle.parent=ext both parameters I
gave you are should result in the system properties.
You could also try to set the directly in code using System.getProperties()!
Tom
On 30.01.15 08:23, Claus Klammer wrote:
> Thank you Tom for your fast response. Unfortunately neither of your
> suggested soltions work. I will not take a look at the differences
> between starting with EclipseStarter and the launcher Main. Do you have
> any additional suggestions? (see my bootstrapping code below, which is
> called from the main class constructor
>
> new Thread() {
> @Override
> public void run() {
> initializeEclipseStarter();
> String[] equinoxArgs =
> {"org.osgi.framework.bundle.parent", "ext", "-console", "-consoleLog",
> "-debug", "debug_options", "-org.osgi.framework.bundle.parent", "ext",
> "-data", "D:/projects/AutoTest/Keba/_out/eclipse/"};
> try {
> EclipseStarter.main(equinoxArgs);
> } catch (Exception e) {
> throw new RuntimeException("Starting OSGI failed!", e);
> }
> }
> }.start();
>
> while (!EclipseStarter.isRunning()) {
> Thread.sleep(1000);
> }
> ............
>
> private void initializeEclipseStarter() {
> Map<String, String> initProps = new HashMap<String, String>();
> initProps.put("osgi.syspath",
> myExportedApplicationLocation+"plugins");
> initProps.put("osgi.install.area", myExportedApplicationLocation);
> initProps.put("org.osgi.framework.bundle.parent", "ext");
>
> EclipseStarter.setInitialProperties(initProps);
> }
>
|
|
| | |
Re: How to startup efxclipse RCP application via EclipseStarter programmatically? [message #1592924 is a reply to message #1592881] |
Fri, 30 January 2015 05:04   |
Eclipse User |
|
|
|
Yes, I use the configuration directory of the exported application.
Did you use the EclipseStarter, too? Documentation (launcher.Main) says that EclipseStarter should be used when started from java.
Excuse me, but I do not understand your comment "but I thing more done than to call"
Thomas Schindl wrote on Fri, 30 January 2015 04:25Yes I have because I had make an OSGi-Application starting as a
(Windows)Service-Daemon but I thing more done than to call
org.eclipse.equinox.launcher.Main.main(String[]) are you also using a
"configuration" directory?
Tom
On 30.01.15 10:10, Claus Klammer wrote:
> I tried it also this way because setting it via SystemProperties (also
> programmatically) did not work for me - sorry for the confusion. I am
> currently investigating the org.eclipse.equinox.launcher.Main and the
> StartupClassLoader. But I've to admit that I did not find out so far,
> how this all fits together. Do you know of any documentation which
> describes the different launching strategies, and use cases of
> equinox.launcher Main and EclipseStarter and why we need a special
> classloading mechanism (extension feature only available when launched
> throw launcher.Main?)?
>
> Have you ever sucessfully started an e4 fx RCP application
> programmatically within another java program? If yes, could you provide
> an example project - I would appreciate it very much.
>
> Any other hints, or links to documentation of this classloading problems
> that help me for better understanding the problem are most welcome.
>
|
|
|
Re: How to startup efxclipse RCP application via EclipseStarter programmatically? [message #1592979 is a reply to message #1592924] |
Fri, 30 January 2015 05:41   |
Eclipse User |
|
|
|
My code looks like this (in reality it is a bit more involved because
I'm looking up the equinox.launcher and create an URLClassloader)
class MyClass {
private static String[] origArgs;
public static void main(String[] args) {
origArgs = args;
// .....
}
public void launch() {
...launcher.Main.launch(origArgs);
}
}
Can you post the content of your config.ini?
Tom
On 30.01.15 11:04, Claus Klammer wrote:
> Yes, I use the configuration directory of the exported application.
> Did you use the EclipseStarter, too? Documentation (launcher.Main) says
> that EclipseStarter should be used when started from java.
>
> Excuse me, but I do not understand your comment "but I thing more done
> than to call"
>
> Thomas Schindl wrote on Fri, 30 January 2015 04:25
>> Yes I have because I had make an OSGi-Application starting as a
>> (Windows)Service-Daemon but I thing more done than to call
>>
>> org.eclipse.equinox.launcher.Main.main(String[]) are you also using a
>> "configuration" directory?
>>
>> Tom
>>
>> On 30.01.15 10:10, Claus Klammer wrote:
>> > I tried it also this way because setting it via SystemProperties (also
>> > programmatically) did not work for me - sorry for the confusion. I am
>> > currently investigating the org.eclipse.equinox.launcher.Main and the
>> > StartupClassLoader. But I've to admit that I did not find out so far,
>> > how this all fits together. Do you know of any documentation which
>> > describes the different launching strategies, and use cases of
>> > equinox.launcher Main and EclipseStarter and why we need a special
>> > classloading mechanism (extension feature only available when launched
>> > throw launcher.Main?)?
>> > > Have you ever sucessfully started an e4 fx RCP application
>> > programmatically within another java program? If yes, could you provide
>> > an example project - I would appreciate it very much.
>> > > Any other hints, or links to documentation of this classloading
>> problems
>> > that help me for better understanding the problem are most welcome.
>> >
>
>
|
|
| | | | |
Re: How to startup efxclipse RCP application via EclipseStarter programmatically? [message #1593694 is a reply to message #1593413] |
Fri, 30 January 2015 15:49  |
Eclipse User |
|
|
|
Hi,
Let's start with Equinox and its classloading which behaves a bit
strange because when it does classloading it simply skips the extension
classpath hence it won't find stuff on that classpath like JavaFX.
The "ext" setting I told you fixes this and makes Equinox behave like
any normal java app including Apache Felix.
In Java7 which we still support e.g. because of STS depending on it the
situation is a bit different because JavaFX is on NO classpath at all
hence even putting Equinox into the "ext" mode would not help,
additionally we can not rely on the "ext" mode when writing Eclipse IDE
plugins who use JavaFX because:
a) we can not simply reconfigure without potentially breaking old bundles
b) we can not do it because the SWT integration still is on no classpath
My comment was that once we can get rid of this stuff we could ditch the
hook stuff completely - my plan is to go down this route once we start
working on Java9 which anyways has jigsaw and everything is a module
anyways ;-)
Tom
On Java7 JavaFX is not on any classpath at all - so no matter what
On 30.01.15 17:22, Claus Klammer wrote:
> Since I am curious (related to your statments see below), could you
> please elaborate in more detail about the implications of the Java7
> support.
> As far as I understand, these problems ("ext" thing) exist because Java7
> does not come with built-in JavaFX support, am I right? How would
> efxclipse differ, if Java7 support could be dismissed?
>
> Quote:
>> I really hope that one day Equinox will make the "ext" setting the
>> default and which would make the fake bundle, the imports, ... needless.
>>
>> In applications who use Nashorn I'm running today already with this
>> setting we currently only keep the hook stuff because of Java7 / RCP and
>> the IDE where we can't simply change this setting.
>
|
|
|
Goto Forum:
Current Time: Mon Jul 07 16:07:09 EDT 2025
Powered by FUDForum. Page generated in 0.07163 seconds
|