Change Java Home while importing project

What do I have to call (program) when I want to change the Java home folder of a project which I import?

I know that I have to use a class which implements org.eclipse.buildship.core.ProjectConfigurator but what do I have to call to set the Java home folder?

At the moment I try to do this but this does not change anything:

ConfigurationManager manager = CorePlugin.configurationManager();
BuildConfiguration currentConfig = manager.loadProjectConfiguration(project).getBuildConfiguration();
BuildConfiguration updatedConfig = manager.createBuildConfiguration(
currentConfig.getRootProjectDirectory(),
true, 
currentConfig.getGradleDistribution(), 
currentConfig.getGradleUserHome(), 
javaHome, 
false, 
false, 
true,
currentConfig.getArguments(), 
currentConfig.getJvmArguments(), 
true, 
true);
manager.saveBuildConfiguration(updatedConfig);