This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have to port smack 3.1.0 library from jdk 1.5 to jdk 1.4. I tried using Retroweaver an Retrotranslator tools for doing the job. However, i wasnt able to get through with either of those.
Is there any other tool available which could perform the job ?
If there isnt, i would have to use the brute force technique of converting the jdk 1.5 specific code ( generics, annotations, for-each loop etc. ) into jdk 1.4 compilant code.
Kindly help me out with this. Any material available on this topic would really help.
Personally I have never used this but you could try to the compile the code using the "-target 1.4" option from the java compiler (javac). I have also seen references stating you also have to target the compiler to the classes library of the Java 1.4 environment (for example: -bootclasspath jdk1.4.2/lib/classes.zip).
Robert Waals wrote:Personally I have never used this but you could try to the compile the code using the "-target 1.4" option from the java compiler (javac).
That will work only if the code itself doesn't use any Java 5 features; that's not the case here.
In any case, translating for-loops and generics is actually pretty simple, and they're handled quite well by a tool like Retroweaver. Annotations can be harder, depending on what they're used for. "@Override" can just be erased, whereas J2EE-related and JUnit4 annotations probably require some human intervention to translate.
Do you know where Retroweaver is going wrong? Can you translate just that one feature by hand, then do the rest automatically?
Retrotranslator tool worked fine when i tried it out again, with some newly accquired knowledge.
Its better than retroweaver, as it covers some of the jdk 1.5 specific features which retroweaver doesnt.
Thanks for all the replies though.