Bug 70284 [1.5] class file with "1.4 compatibility" cannot be run in Java 1.4
If I compile a simple class in Eclipse with the following compliance settings, it won't run in a 1.4 JVM. It appears the .class file relies on 1.5 libraries, despite the compatibility setting. Compiler compliance: 1.5 Generated .class compatibility: 1.4 Source compatibility: 1.5 Here's my source code: public class TestConcat { public static void main(String[] args) { String w = "world"; System.out.println("Hello " + w); } } The resulting exception: Exception in thread "main" java.lang.NoClassDefFoundError: java/lang/StringBuilder at TestConcat.main(TestConcat.java:13)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/preferences/CompilerConfigurationBlock.java
description.setLayoutData(gd);		
		String label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_overriding_pkg_dflt.label"); 
		addComboBox(composite, label, PREF_PB_OVERRIDING_PACKAGE_DEFAULT_METHOD, errorWarningIgnore, errorWarningIgnoreLabels, 0);			
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_method_naming.label"); 
		addComboBox(composite, label, PREF_PB_METHOD_WITH_CONSTRUCTOR_NAME, errorWarningIgnore, errorWarningIgnoreLabels, 0);			
		
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_static_access_receiver.label"); 
		addComboBox(composite, label, PREF_PB_STATIC_ACCESS_RECEIVER, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_indirect_access_to_static.label"); 
		addComboBox(composite, label, PREF_PB_INDIRECT_STATIC_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0);	
		
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_no_effect_assignment.label"); 
		addComboBox(composite, label, PREF_PB_NO_EFFECT_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_accidential_assignement.label"); 
		addComboBox(composite, label, PREF_PB_POSSIBLE_ACCIDENTAL_BOOLEAN_ASSIGNMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_unqualified_field_access.label"); 
		addComboBox(composite, label, PREF_PB_UNQUALIFIED_FIELD_ACCESS, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_finally_block_not_completing.label"); 
		addComboBox(composite, label, PREF_PB_FINALLY_BLOCK_NOT_COMPLETING, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_empty_statement.label"); 
		addComboBox(composite, label, PREF_PB_EMPTY_STATEMENT, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_undocumented_empty_block.label"); 
		addComboBox(composite, label, PREF_PB_UNDOCUMENTED_EMPTY_BLOCK, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		label= PreferencesMessages.getString("CompilerConfigurationBlock.pb_missing_serial_version.label"); 
		addComboBox(composite, label, PREF_PB_MISSING_SERIAL_VERSION, errorWarningIgnore, errorWarningIgnoreLabels, 0);
		
		return composite;
	}