How could I set the global Java home of the Eclipse Buildship plug-in programmatically?
To do it manually you have to go to the preference page and set it in the field here:
I want to know how to set it via API. I use Buildship 3.1.10.
How could I set the global Java home of the Eclipse Buildship plug-in programmatically?
To do it manually you have to go to the preference page and set it in the field here:
I want to know how to set it via API. I use Buildship 3.1.10.
There’s no dedicated functionality for that, but Buildship uses the standard Eclipse Preferences API. Take a look at how WorkspaceConfigurationPersistence
stores and retrieves the Java home:
Thanks, I will try your solution.
I tried to set the preference for the Java home in an event handler which is called at the ui life cycle UILifeCycle.APP_STARTUP_COMPLETE.
The preferences property is set (I see the change in the file) but when I open the preference page of Buildship in Eclipse then the field “Java home” is not set and also the content of the preference file changed to an empty value.
How can I force to start the Buildship plugin and initialize the preferences before I set my new preference value?
What is the Buildship plugin doing with its preferences while Eclipse is starting up? I see my entry going when I wait for Eclipse to be fully started. The removing of the java.home
property does not depend on opening the Gradle preferences page in Eclipse.
It is not the Buildship plugin which changes the preferences after I changed it. I found out that it is the Oomph plugin in org.eclipse.oomph.setup.impl.SetupTaskImpl
which changes the preference back to its previous value which is null.
I added my question to the Oomph discussions here: Setting a preference property while starting Eclipse not working · eclipse-oomph · Discussion #141 · GitHub