string.replace("foo", "bar")complies in this setup but will not run with a 1.4 jre, because
replace(CharSequence target, CharSequence replacement)is new in 1.5.
The solution is to setup only the plugins that really need 1.5 to use 1.5 Eclipse has the concept of Execution Environments to specify which java JREs a plugin is compatible with.
1. set in the preferences an 1.4 jre as default and have an 1.5 installed:
2. In the project properties set the java compiler 1.5 (which is Compiler complience level 5.0 -- how I love the ever changing java version naming...):
3. Set the execution environment in the build path to J2SE-1.5:
4. In the plugin MANIFEST.MF, set the execution environment to J2SE-1.5 as well:
You could also directly add the following line to the MANIFEST.MF file
That's it :-)
You could also read http://wiki.eclipse.org/index.php/Execution_Environments.
ReplyDeleteNiel, I just checked it and it is not true. If you are not applying step 3 then 1.5 functionality is not available. Simple test: "a".replace("a","b"); does not work, unless you apply step 3. (Assuming your default execution environment is 1.4!)
ReplyDelete