I recently started working in an environment which runs Java v1.4.2 on the server and in production. While trying to set up my workstation development environment, I found that I could no longer download Oracle JDK. I need to be able to compile code offline and generate WAR/EAR files to deploy into the test environment (there is no viable dev environment for this).
the most significant piece of code that suffers from 1.4.2 vs. 1.6 disparity is the parsing of time/date formats using SimpleDateFormat:
so, two questions:
Is there a compile option that will allow me to use the 1.6 compiler to generate code for a 1.4.2 server? (or where can I find Windows versions of the JDK?)
How can I simply rewrite the date/time arithmetic for 1.4.2?
Note that support for Java 1.4.2 is no longer free. You will not get security updates and bug fixes for Java 1.4.2 for free anymore. If your company for some reason doesn't want to upgrade to a newer version, they can purchase business support for Java 1.4.2 from Oracle. It would be better if your company would seriously consider upgrading to at least Java 6.
Dan McGinn-Combs wrote:Is there a compile option that will allow me to use the 1.6 compiler to generate code for a 1.4.2 server?
Use the -source 1.4 and -target 1.4 compiler flags, and make sure that you do not use any class, method or field that was added in Java 5.0 or beyond. If you use any of those you'll get a NoClassDefFoundError, NoSuchMethodError or NoSuchFieldError during runtime.
If you use Eclipse and have some old 1.4 JRE installed you can setup the 1.4 JRE inside Eclipse and use that for the project; that will help you prevent the usage of newer features. You can also set the compiler version to 1.4 from Eclipse.
Netbeans probably has similar features but I haven't used Netbeans so I couldn't confirm this.