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
}
	private IStatus validateCompliance() {
		StatusInfo status= new StatusInfo();
		String compliance= (String) fWorkingValues.get(PREF_COMPLIANCE);
		String source= (String) fWorkingValues.get(PREF_SOURCE_COMPATIBILITY);
		String target= (String) fWorkingValues.get(PREF_CODEGEN_TARGET_PLATFORM);
		
		if (VERSION_1_3.equals(compliance)) {
			if (VERSION_1_4.equals(source) || VERSION_1_5.equals(source)) {
				status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13src145.error")); 
				return status;
			} 
			if (VERSION_1_4.equals(target) || VERSION_1_5.equals(target)) {
				status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl13trg145.error")); 
				return status;
			}
		} else if (VERSION_1_4.equals(compliance)) {
			if (VERSION_1_5.equals(source)) {
				status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl14src15.error")); 
				return status;
			} 
			if (VERSION_1_5.equals(target)) {
				status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.cpl14trg15.error")); 
				return status;
			}			
		}
		if (VERSION_1_4.equals(source)) {
			if (VERSION_1_1.equals(target) || VERSION_1_2.equals(target) || VERSION_1_3.equals(target)) {
				status.setError(PreferencesMessages.getString("CompilerConfigurationBlock.src14tgt14.error")); 
				return status;