Bug 433416 - Launch configurations can default to an unbound execution environment
Summary: Launch configurations can default to an unbound execution environment
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.4   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.4 M7   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks:
 
Reported: 2014-04-24 09:39 EDT by Thomas Raddatz CLA
Modified: 2014-04-29 15:30 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Raddatz CLA 2014-04-24 09:39:44 EDT
Eclipse produces a launch configuration with Java 1.8 when launching an Eclipse application for a plug-in, although Java 1.8 is not installed on the PC and hence is not available for Eclipse.

Tested with:

Version: Luna (4.4)
Build id: N20140423-2200
Comment 1 Curtis Windatt CLA 2014-04-24 10:59:55 EDT
Reproduced.

When creating a project, the default EE is based on the default JRE.

// Set default EE based on strict match to default VM
IVMInstall defaultVM = JavaRuntime.getDefaultVMInstall();
String[] EEChoices = fEEChoice.getItems();
for (int i = 0; i < EEChoices.length; i++) {
if (!EEChoices[i].equals(NO_EXECUTION_ENVIRONMENT)) {
		if (VMUtil.getExecutionEnvironment(EEChoices[i]).isStrictlyCompatible(defaultVM)) {
			fEEChoice.select(i);
			break;
		}
	}
}

When creating the launch configuration, the default EE is based on the highest bundle required execution environment of any bundle in the launch configuration.  As org.eclipse.jdt.annotation has a BREE of 1.8, 1.8 is chosen as the EE.

One solution would be to skip any EE that is unbound, though that could mean setting an EE that doesn't match your plug-ins, so installing a JRE would not fix your launch configuration.  Would be good to see why jdt.annotation has such a high BREE.
Comment 2 Curtis Windatt CLA 2014-04-24 13:08:29 EDT
http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=20701afb2a9094b1fc905d295c9191bb8075a887
Fixed in master

The key was not to break the feature added in Bug 344633, where we look at the plug-in list to guess what the best EE to choose is.  To do this I ignore bundles that have BREEs that match unbound EEs (no compatible JRE installed).  This doesn't guarantee that the launch configuration will run, but choosing an unbound EE will definitely not launch, so this is better than nothing.

This problem would have become much more noticeable in 4.4 as the jdt annotations bundle in the SDK has a 1.8 BREE.  You don't need to the bundle to launch, but PDE has no practical way of knowing that.
Comment 3 Thomas Raddatz CLA 2014-04-25 04:47:38 EDT
Re-tested today with "Version: Luna (4.4) Build id: N20140424-2000".
Works like a charm, now. Thanks.