First of all WAS CE has a completely different code base compared to other WAS editions (WAS Base, WAS ND etc.). It is based on open source technologies like Apache Geronimo, so you should not be using WAS CE to mimic your WAS 5.1 environment (at sum these are two different servers altogether, only brand name is common).
Main point when running Enterprise Java Applications on application servers is Java EE specification levels, not JRE version. WAS 5.1 supports J2EE 1.2 and 1.3. To determine which one you are using, you shall examine your deployment descriptors (application.xml / web.xml files). Then check Specifications and API documentation at infocenter;
- WAS 6.1 supports J2EE 1.2, 1.3 and 1.4
- WAS 7 support J2EE 1.3, 1.4 and Java EE 5
So if your application is J2EE 1.2 you can use WAS 6.1, and if it is J2EE 1.3 you can use WAS 7. Unfortunately you can't use a newer version of WAS before you migrate your project to a higher specification level (infocenter contains information on how to do that). I strongly suggest you do so because WAS 5.1 is out of support and even WAS 6.1 will be out of support this year.
As per Java SE version, you don't have a problem, your Java SE 1.4 compiled code will run on Java SE 5 and 6 JRE's because of backward compatibility of byte code. Of course if you upgrade your project to later J2EE specifications, you may use a more recent JRE; just compile your migrated project with a newer SDK (there is a little catch though; moving from 1.4 to 5 Java had some new keywords like
enum, so you must check your code to make sure you don't use these as variable names).
For some time WebSphere has a Developers Edition. You can add this as a free WAS test server to your eclipse; at sum, if you are lucky and your project is J2EE 1.3 and not 1.2 you can use WAS 7.0 with this setup.
Use the no-charge WebSphere Application Server Developer Tools for Eclipse (WDT) to develop applications for WAS V7.0, V8.0, V8.5 including the Liberty profile. WDT is a subset of Rational Application Developer that can be installed on top of your existing Eclipse environment.