Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » earlystartup() does not work
earlystartup() does not work [message #847276] Tue, 17 April 2012 06:45 Go to next message
Robinson S is currently offline Robinson S
Messages: 4
Registered: April 2012
Junior Member
I downloaded a fresh eclipse IDE (Java EE IDE for Web developers - Indigo Service Release 2). I created a plug-in project where I added extension, org.eclipse.ui.startup. Then I created a package wherein I created a class that extends IStartup. In the earlystartup() method I inserted a code for creating a file as given below.

try{
// Create file
FileWriter fstream = new FileWriter("c:/temp/outout.txt");
BufferedWriter out = new BufferedWriter(fstream);
out.write("Hello Java");
//Close the output stream
out.close();
}catch (Exception e){//Catch exception if any
System.err.println("Error: " + e.getMessage());
}

Moreover I unchecked "Activate this plug-in when one of its classes is loaded" checkbox.
And in the plugin.xml file added the "startup class" element.

I restarted the eclipse hoping that a file will be created but nothing happens.

Please help me to resolve this issue.
Re: earlystartup() does not work [message #847302 is a reply to message #847276] Tue, 17 April 2012 07:13 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2012-04-17 08:45, Robinson S wrote:
> I downloaded a fresh eclipse IDE (Java EE IDE for Web developers -
> Indigo Service Release 2). I created a plug-in project where I added
> extension, org.eclipse.ui.startup. Then I created a package wherein I
> created a class that extends IStartup. In the earlystartup() method I
> inserted a code for creating a file as given below.
>
> try{
> // Create file FileWriter fstream = new FileWriter("c:/temp/outout.txt");
> BufferedWriter out = new BufferedWriter(fstream);
> out.write("Hello Java");
> //Close the output stream
> out.close();
> }catch (Exception e){//Catch exception if any
> System.err.println("Error: " + e.getMessage());
> }
>
> Moreover I unchecked "Activate this plug-in when one of its classes is
> loaded" checkbox.
> And in the plugin.xml file added the "startup class" element.
>
> I restarted the eclipse hoping that a file will be created but nothing
> happens.
>
> Please help me to resolve this issue.

Two items come into my mind:

a) Have you also provided a "startup" plugin element? The extension
point description says that this is deprecated and works only together
with the runtime compatibility bundle. I wouldn't count on that, so
ensure that the element is provided.

b) The extension point org.eclipse.ui.startup is considered as a
non-binding request, because users can prevent this startup to take
place via the preferences. Search for "startup and shutdown" in the
preferences.

HTH & Greetings from Bremen,

Daniel Krügler
Re: earlystartup() does not work [message #847303 is a reply to message #847302] Tue, 17 April 2012 07:14 Go to previous messageGo to next message
Daniel Krügler is currently offline Daniel Krügler
Messages: 853
Registered: July 2009
Senior Member
On 2012-04-17 09:13, Daniel Krügler wrote:
> On 2012-04-17 08:45, Robinson S wrote:
>> I downloaded a fresh eclipse IDE (Java EE IDE for Web developers -
>> Indigo Service Release 2). I created a plug-in project where I added
>> extension, org.eclipse.ui.startup. Then I created a package wherein I
>> created a class that extends IStartup. In the earlystartup() method I
>> inserted a code for creating a file as given below.
>>
>> try{
>> // Create file FileWriter fstream = new FileWriter("c:/temp/outout.txt");
>> BufferedWriter out = new BufferedWriter(fstream);
>> out.write("Hello Java");
>> //Close the output stream
>> out.close();
>> }catch (Exception e){//Catch exception if any
>> System.err.println("Error: " + e.getMessage());
>> }
>>
>> Moreover I unchecked "Activate this plug-in when one of its classes is
>> loaded" checkbox.
>> And in the plugin.xml file added the "startup class" element.
>>
>> I restarted the eclipse hoping that a file will be created but nothing
>> happens.
>>
>> Please help me to resolve this issue.
>
> Two items come into my mind:
>
> a) Have you also provided a "startup" plugin element? The extension
> point description says that this is deprecated and works only together
> with the runtime compatibility bundle.

Here I meant: It is deprecated *not* to provide this element.

>I wouldn't count on that, so
> ensure that the element is provided.
>
> b) The extension point org.eclipse.ui.startup is considered as a
> non-binding request, because users can prevent this startup to take
> place via the preferences. Search for "startup and shutdown" in the
> preferences.
>
> HTH & Greetings from Bremen,
>
> Daniel Krügler
>
Re: earlystartup() does not work [message #847400 is a reply to message #847303] Tue, 17 April 2012 09:05 Go to previous messageGo to next message
Robinson S is currently offline Robinson S
Messages: 4
Registered: April 2012
Junior Member
Thanks Daniel Krügler for the reply.
Yes I have included startup element.

I am getting the following exception when the eclipse is restarted. Could it be a reason why early startup does not work?

org.eclipse.equinox.security.storage.StorageException: Unable to locate secure storage module (org.eclipse.equinox.security.windowspasswordprovider).
at org.eclipse.equinox.internal.security.storage.PasswordProviderSelector.findStorageModule(PasswordProviderSelector.java:190)
at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getModulePassword(SecurePreferencesRoot.java:231)
at org.eclipse.equinox.internal.security.storage.SecurePreferencesRoot.getPassword(SecurePreferencesRoot.java:224)
at org.eclipse.equinox.internal.security.storage.SecurePreferences.get(SecurePreferences.java:262)
at org.eclipse.equinox.internal.security.storage.SecurePreferencesWrapper.get(SecurePreferencesWrapper.java:106)
at org.eclipse.core.internal.net.ProxyType.loadProxyAuth(ProxyType.java:537)
at org.eclipse.core.internal.net.ProxyType.createProxyData(ProxyType.java:138)
at org.eclipse.core.internal.net.ProxyType.getProxyData(ProxyType.java:127)
at org.eclipse.core.internal.net.ProxyType.initialize(ProxyType.java:517)
at org.eclipse.core.internal.net.ProxyManager.initialize(ProxyManager.java:274)
at org.eclipse.core.internal.net.Activator.start(Activator.java:181)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:683)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:463)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
at org.eclipse.osgi.internal.loader.SingleSourcePackage.loadClass(SingleSourcePackage.java:35)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:473)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Unknown Source)
at java.lang.Class.getConstructor0(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadBundleActivator(AbstractBundle.java:166)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.start(BundleContextImpl.java:679)
at org.eclipse.osgi.framework.internal.core.BundleHost.startWorker(BundleHost.java:381)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.start(AbstractBundle.java:299)
at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:440)
at org.eclipse.osgi.internal.loader.BundleLoader.setLazyTrigger(BundleLoader.java:268)
at org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:107)
at org.eclipse.osgi.baseadaptor.loader.ClasspathManager.findLocalClass(ClasspathManager.java:463)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.findLocalClass(DefaultClassLoader.java:216)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:400)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:476)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:429)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:417)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:345)
at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:229)
at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1207)
at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
at org.eclipse.ui.internal.util.Util.safeLoadExecutableExtension(Util.java:879)
at org.eclipse.ui.internal.menus.DynamicToolBarContributionItem.createContributionItem(DynamicToolBarContributionItem.java:183)
at org.eclipse.ui.internal.menus.DynamicToolBarContributionItem.getContributionItem(DynamicToolBarContributionItem.java:176)
at org.eclipse.ui.internal.menus.DynamicToolBarContributionItem.createControl(DynamicToolBarContributionItem.java:278)
at org.eclipse.jface.action.ControlContribution.fill(ControlContribution.java:97)
at org.eclipse.jface.action.ToolBarManager.update(ToolBarManager.java:353)
at org.eclipse.jface.action.ToolBarManager.createControl(ToolBarManager.java:111)
at org.eclipse.ui.internal.menus.TrimContributionManager$ToolBarTrimProxy.dock(TrimContributionManager.java:88)
at org.eclipse.ui.internal.menus.TrimContributionManager.update(TrimContributionManager.java:265)
at org.eclipse.ui.internal.WorkbenchWindow.updateLayoutDataForContents(WorkbenchWindow.java:3874)
at org.eclipse.ui.internal.WorkbenchWindow.setLayoutDataForContents(WorkbenchWindow.java:3885)
at org.eclipse.ui.internal.WorkbenchWindow.createDefaultContents(WorkbenchWindow.java:1157)
at org.eclipse.ui.internal.WorkbenchWindowConfigurer.createDefaultContents(WorkbenchWindowConfigurer.java:623)
at org.eclipse.ui.application.WorkbenchWindowAdvisor.createWindowContents(WorkbenchWindowAdvisor.java:300)
at org.eclipse.ui.internal.WorkbenchWindow.createContents(WorkbenchWindow.java:1043)
at org.eclipse.jface.window.Window.create(Window.java:431)
at org.eclipse.ui.internal.Workbench$68.runWithException(Workbench.java:3664)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.application.WorkbenchAdvisor.openWindows(WorkbenchAdvisor.java:803)
at org.eclipse.ui.internal.Workbench$33.runWithException(Workbench.java:1600)
at org.eclipse.ui.internal.StartupThreading$StartupRunnable.run(StartupThreading.java:31)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:35)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:135)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4140)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3757)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2609)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.Main.main(Main.java:1386)
Re: earlystartup() does not work [message #854138 is a reply to message #847276] Mon, 23 April 2012 17:45 Go to previous message
Nitin Dahyabhai is currently offline Nitin Dahyabhai
Messages: 2310
Registered: July 2009
Senior Member
On 4/17/2012 2:45 AM, Robinson S wrote:
> I downloaded a fresh eclipse IDE (Java EE IDE for Web developers -
> Indigo Service Release 2). I created a plug-in project where I added
> extension, org.eclipse.ui.startup. Then I created a package wherein I
> created a class that extends IStartup. In the earlystartup() method I

You meant earlyStartup(), right?

---
Nitin Dahyabhai
Eclipse WTP Source Editing and JSDT
IBM Rational


---
Nitin Dahyabhai
Eclipse WTP, IBM
Previous Topic:Adding JAX-RS facet to Dynamic Web Project for GlassFish 3
Next Topic:JFace tree - saving tree state while refreshing
Goto Forum:
  


Current Time: Sat Oct 25 03:35:35 GMT 2014

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

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