I actually figured out the answer to my question just before clicking the "Post" button, but this has been so frustrating for me, I am going ahead and posting it in the hopes that it will help someone else. The answer is below.
I am using Eclipse Kepler, which is built with Java 1.7 (but I don't think that comes into play in this issue). My problem is that I'm ending up with different versions of java in different projects.
I have several related projects, I'll call them BV_S, BV_A, and BV_L. Before I took over this work, there was an ugly Subversion External thing set up so that the BV_A and BV_L project would each pull in some java source files from deep in the bowels of the BV_S project. To clean this up, I decided to pull all that shared source out and create a new BV_Common project, which would create a BV_Common.jar file, and then I'd use that .jar in building each of the three existing projects. Historically, these projects used a mixture of Java 1.5 and 1.6. My intent is to do everything with 1.6.
I've created the BV_Common.jar file, checked it into Subversion, and set up Subversion External properties in the other projects so that this .jar file is available in each of the BV_S, BV_A, and BV_L projects, and modified the Properties for each of the three projects to include BV_Common.jar.
When I run the build.xml script in each of these projects using "Run as ANT script", I get differing results. BV_L builds just fine. BV_A and BV_S both get the dreaded "bad class file blah blah BV_Common.jar . . . class file has wrong version 50.0, should be 49.0" error -- an indication that I'm trying to use a .jar file built with Java 1.6 while running java 1.5.
In all these projects, the build.xml file references an elaborate collection of shared build XML files (pulled in from a single common source). One of the things these files do is print out the value of "java.version". For the BV_L project, it's reported as 1.6.0_30; for BV_S and BV_C it's 1.5.0_14. So somehow, somewhere, these projects are being told to use (or be compatible with?) Java 1.5. But for the life of me, I can't figure out where.
Here's what I've looked at. In all cases, the values I see are identical on all four projects (BV_Common, BV_L, BV_C and BV_S):
In the project Properties screen, Java Build Path, on the Libraries tab, the JRE System Library is set to use the "Execution environment" of "JavaSE-1.6 (jdk1.6.0_30)".
In the project Properties screen, Java Compiler, the "Enable project specific settings" box is checked, and under JDK Compliance, the "Use compliance from execution environment 'JavaSE-1.6' on the 'Java Build Path'" checkbox is checked.
In each project, there is a .settings folder, and within that, a org.eclipse.jdt.core.prefs file. These files are byte-for-byte identical from project to project. In particular, they each contain these lines:
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.source=1.6
In each project, there is a .project file (which I presume controls Eclipse); these files are all identical except for the project name.
Each project has a .classpath file, and these differ because each project has a different set of various .jar files it needs, but they all contain the line
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
and they contain nothing else that looks like a java compiler, JDK, or JRE specification.
The build.xml script for BV_Common is different from the others, because it's creating a .jar file, but the remaining three projects are all nearly identical in their build scripts. They differ only in the following:
project.name property
project.jvm_arguments property -- one specifies an additional -D option to identify a configuration file.
But somewhere, something is associating Java 1.5 with my BV_L and BV_S projects.
I've tried shutting down and restarting Eclipse.