Paul Fullbright wrote:
I guess the only reason I've been compiling with jdk 1.4-"compliant"
jdk 1.5 is that I want to run with 1.5 by default, and to change the
compiler, you'd have to change the compiler for each project (which
would then be forced on others via the .project file), or you'd have to
change the jre for each "run" configuration. Is there any way to set a
jre as the default compiler, but a different jre as the default "run"
jre?
In Eclipse there is no concept of a 1.5 compiler or a 1.4
compiler, you use the same [Eclipse] compiler no matter what compliance
level you set. You do not use the compiler supplied by a
specified JRE. (Which is why you specify a JRE, not a JDK.) What you do
specify is:
- The compliance level (via
Preferences->Java->Compiler->Compiler compliance level or
Project->Properties->JavaCompiler->Compiler
compliance level) - This setting tells the Eclipse compiler what language
features you want to allow (e.g. jdk1.4 allows assertions,
jdk1.5 allows @Annotations).
- The JRE System Library (via
Preferences->Java->Installed JREs->check box for "default" or
Project->Properties->Java Build Path->Libraries->JRE System
Library->Edit...) - This setting tells the Eclipse compiler what JRE
classes you want to have on your build path (e.g. jdk1.4
added the java.util.logging package, jdk1.5 added the
java.lang.annotation package).
I execute my Eclipse workspace using jdk1.4, and I specify my
default Compiler compliance level to be 1.4 and my default JRE to be a
1.4 JRE. This prevents me from accidentally using either jdk1.5
language features (e.g. annotations) or jdk1.5 classes (e.g.
java.lang.Appendable). This also causes my "target" Eclipse workspace
to start up with runtime JRE of 1.4, which is what we are targetting
for 0.5/Callisto. The only hassle is that I need to add a 1.5 JRE to my
list of Installed JREs and designate it as the default every time
I clear the "target" workspace. New EJB projects are then created by
default with a Compliance level of 1.5 and a JRE System Library of 1.5,
which, after adding the ejb3.jar to the build path also, is what I need
to test my stuff.
Executing the "target" workspace on jdk1.5 is not the Callisto target,
so I avoid it; but I guess we should be testing that scenario... Either
way, I move that no one should be building Dali on top of a 1.5 JRE
System Library. That's just begging for problems and incompatibilities
like the cryptic compiler errors we just encountered.
Brian
|