Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / First Aid / February 2006

Tip: Looking for answers? Try searching our database.

Force downward source compatibility?

Thread view: 
Bert Hyman - 13 Feb 2006 20:20 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?

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/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.