If a user has JDK 1.5.x installed but must write code for a system with
JRE 1.4.x installed, other than self-discipline, are there any
mechanical techniques or aids to prevent coding that uses classes or
methods that don't exist in 1.4?
The envirionment is Eclipse 3.1.2, if that matters.

Signature
Bert Hyman | St. Paul, MN | bert@iphouse.com
Monique Y. Mudama - 13 Feb 2006 20:43 GMT
> If a user has JDK 1.5.x installed but must write code for a system
> with JRE 1.4.x installed, other than self-discipline, are there any
> mechanical techniques or aids to prevent coding that uses classes or
> methods that don't exist in 1.4?
Install 1.4.x and use that instead?
It's easy to switch JREs for a given project in Eclipse.

Signature
monique
Ask smart questions, get good answers:
http://www.catb.org/~esr/faqs/smart-questions.html
Bert Hyman - 13 Feb 2006 21:05 GMT
>> If a user has JDK 1.5.x installed but must write code for a system
>> with JRE 1.4.x installed, other than self-discipline, are there
[quoted text clipped - 4 lines]
>
> It's easy to switch JREs for a given project in Eclipse.
Not to put too fine a point on it, you haven't met our "customers".
Still, we're already at work enhancing our feature to include
automatically modifying the project's "build path" on the user's
specifying the target JRE level, assuming we can get the user to
accurately tell us where the alternate libraries are.
Still, there's no guarantee that they'll do it right, so short of
actually deploying the app to the target and having it blow up, is
there a utility that can examine a jar file (or set of class files)
to match it up with a sample JRE and look for missing method
signatures or classes?
If you can't tell, I'm not really a Java wizard; I just write
Eclipse plugins which happen to be coded in Java.

Signature
Bert Hyman | St. Paul, MN | bert@iphouse.com
Thomas Hawtin - 13 Feb 2006 21:07 GMT
> If a user has JDK 1.5.x installed but must write code for a system with
> JRE 1.4.x installed, other than self-discipline, are there any
> mechanical techniques or aids to prevent coding that uses classes or
> methods that don't exist in 1.4?
Use
-source 1.4 -target 1.4 -bootclasspath /usr/java/j2re1.4.2/lib/rt.jar
Self-discipline isn't always enough. For instance, if you were compiling
1.3 code on 1.4 with -bootclasspath, then the following code wouldn't
work on 1.3 (not tested).
class Oops {
public static void main(String[] args) {
StringBuffer buff = new StringBuffer()
buff.append("stuff");
StringBuffer buff2 = new StringBuffer()
buff2.append(buff);
System.out.println(buff2);
}
}
Tom Hawtin

Signature
Unemployed English Java programmer
http://jroller.com/page/tackline/