Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » eclipse standalone update
eclipse standalone update [message #465191] Mon, 26 March 2007 07:04 Go to next message
Stefan is currently offline StefanFriend
Messages: 27
Registered: July 2009
Junior Member
Hi All,

I am trying to use the standalone update manager api but hit a roadblock - any comment would be helpful..

I created a plugin that has
Require-Bundle: org.eclipse.update.core,
org.eclipse.core.runtime,
org.eclipse.update.configurator

Then a simple java file that has

String fromSite="file:/C:/_Eclipse/extensions/myextension/eclipse";
ListFeaturesCommand cmd = new ListFeaturesCommand(fromSite);

Any of these commands (ListFeaturesCommand, InstallCommand..) throw an exception. This happens with jdk 1.5 and eclipse 3.0 also tries 3.2.1, 3.2.2, 3.3M5.

In ConfiguratorUtils context is null.

BundleContext context = ConfigurationActivator.getBundleContext();


Exception in thread "main" java.lang.NullPointerException
at org.eclipse.update.configurator.ConfiguratorUtils.getCurrent PlatformConfiguration(ConfiguratorUtils.java:43)
at org.eclipse.update.internal.core.LocalSite.internalGetLocalS ite(LocalSite.java:66)
at org.eclipse.update.internal.core.InternalSiteManager.interna lGetLocalSite(InternalSiteManager.java:81)
at org.eclipse.update.internal.core.InternalSiteManager.getLoca lSite(InternalSiteManager.java:66)
at org.eclipse.update.core.SiteManager.getLocalSite(SiteManager .java:128)
at org.eclipse.update.standalone.ScriptedCommand.getConfigurati on(ScriptedCommand.java:100)
at org.eclipse.update.standalone.InstallCommand.getTargetSite(I nstallCommand.java:211)
at org.eclipse.update.standalone.InstallCommand.<init>(InstallCommand.java:84)
at Installer.main(Installer.java:60)


Thanks
Re: eclipse standalone update [message #465203 is a reply to message #465191] Mon, 26 March 2007 11:29 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
How are you running it?

bad: java com.foo.MyApp

good: eclipse -application com.foo.MyApp

Chances are, you're not actually starting either OGSi or the platform, so things that are just expected to be there haven't beee started yet.

Have you read the document on updating the code from the command line?

http://help.eclipse.org/help32/topic/org.eclipse.platform.do c.isv/reference/misc/update_standalone.html

You'll want to follow something like that.

Alex.
Re: eclipse standalone update [message #465237 is a reply to message #465191] Mon, 26 March 2007 15:30 Go to previous messageGo to next message
Stefan is currently offline StefanFriend
Messages: 27
Registered: July 2009
Junior Member
Hi Alex,

How can I start OSGI and the platform?
I have looked at http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse. platform.doc.isv/reference/misc/update_standalone.html

They say it is best to use the classes from the command line but possible to use them programmatically.

I am mainly trying to find out how to install not just 1 feature but its dependencies as well?

Stefan
Re: eclipse standalone update [message #465240 is a reply to message #465237] Mon, 26 March 2007 16:40 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
It's not the code that you're executing, but the way that you're executing it.

You should have a command-line application that uses the IPlatformRunnable (or in Eclipse 3.3, IApplication ... but let's not worry about that now) and then invoke it with

eclipse -application YourAppNameHere

That will start up OSGi and then run your code.

See

http://help.eclipse.org/help32/topic/org.eclipse.platform.do c.user/tasks/running_eclipse.htm
http://help.eclipse.org/help32/topic/org.eclipse.platform.do c.isv/reference/extension-points/org_eclipse_core_runtime_ap plications.html

You need to create an extension point to the org.eclipse.core.runtime.applications point, which basically is a class that implements IPlatformRunnable if memory serves me correct.


<extension id="YourApp" point="org.eclipse.core.runtime.applications">
<application>
<run class="com.example.YourUpdateCode"/>
</application>
</application>
[/xml]

package com.example;
public class YourUpdateCode implements IPlatformRunnable {
  public Object run(Object data) throws Exception {
    System.out.println("Hello World"); // ...
  }
}


eclipse -application YourApp


That's how you do it.

Alex.
Re: eclipse standalone update [message #465246 is a reply to message #465191] Mon, 26 March 2007 20:30 Go to previous messageGo to next message
Stefan is currently offline StefanFriend
Messages: 27
Registered: July 2009
Junior Member
Hi Alex,

thanks for the directions!
I created an eclipse plugin project and had the wizard generate an activator and make it into a RCP.

It works fine and prints
Hello RCP World!

In the plugin dependencies I have org.eclipse.core.runtime listed only.
When I add other plugin such as org.eclipse.update.core I get an exception and the application is not able to start.
How can this be fixed?

Stefan


java.lang.RuntimeException: Application "extended.application" could not be found in the registry. The applications available are: <NONE>.
at org.eclipse.core.internal.runtime.PlatformActivator$1.run(Pl atformActivator.java:68)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .runApplication(EclipseAppLauncher.java:92)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher .start(EclipseAppLauncher.java:68)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:400)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseS tarter.java:177)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce ssorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe thodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.eclipse.core.launcher.Main.invokeFramework(Main.java:336 )
at org.eclipse.core.launcher.Main.basicRun(Main.java:280)
at org.eclipse.core.launcher.Main.run(Main.java:977)
at org.eclipse.core.launcher.Main.main(Main.java:952)
Re: eclipse standalone update [message #465248 is a reply to message #465246] Mon, 26 March 2007 21:33 Go to previous messageGo to next message
Alex Blewitt is currently offline Alex BlewittFriend
Messages: 946
Registered: July 2009
Senior Member
You're probably missing out on a required dependency, like org.eclipse.equinox.common. To find out, run eclipse -application blah -console -noExit and you'll go into the OSGi console.

Type ss that will show the status of the bundles; if it's shown as INSTALLED then there's a problem with the dependencies -- type 'diag 123' (or whatever the number by the plugin is) and it'll show what's missing.

Alex.
Re: eclipse standalone update [message #465250 is a reply to message #465248] Mon, 26 March 2007 22:14 Go to previous message
Stefan is currently offline StefanFriend
Messages: 27
Registered: July 2009
Junior Member
thank you Alex - you are a wizard!

Seems like just adding org.eclipse.update.core besides org.eclipse.core.runtime works fine.
My runtime configuration must have been corrupted.

Now I can have list the installed features with

public Object run(Object args) throws Exception {
System.out.println("Hello RCP World!");
ListFeaturesCommand cmd = new ListFeaturesCommand(null);
cmd.run();
return IPlatformRunnable.EXIT_OK;
}

in Application.java created by the eclipse plugin wizard.

Stefan
Previous Topic:RCP gets locked up
Next Topic:Version Problems
Goto Forum:
  


Current Time: Wed Jan 15 13:42:09 GMT 2025

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

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

Back to the top