File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Porting a source library in jdk 1.5 to jdk 1.4 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Porting a source library in jdk 1.5 to jdk 1.4" Watch "Porting a source library in jdk 1.5 to jdk 1.4" New topic
Author

Porting a source library in jdk 1.5 to jdk 1.4

Nishant Suneja
Greenhorn

Joined: Jan 22, 2009
Posts: 6
Hi

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.
Robert Waals
Greenhorn

Joined: Dec 22, 2006
Posts: 14
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).

For more information: Javac

Regards,
Robert Jan
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24187
    
  34

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?


[Jess in Action][AskingGoodQuestions]
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

Are you perhaps using Iterable? Because Retroweaver explicitly states that it can have problems with that.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Nishant Suneja
Greenhorn

Joined: Jan 22, 2009
Posts: 6
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.
sagar bhagat
Greenhorn

Joined: May 23, 2008
Posts: 1
Hi Nishant,

I am also having the same problem, have to port smack library in Java ME.

I am developing IM client in Java ME.

Through your discussion came to know that you have successfully ported the smack api into jdk 1.4.

Can you provide me the process of conversion, also whether you were able to use the library for Java ME.

Thanks in advance

Sagar

Nishant Suneja
Greenhorn

Joined: Jan 22, 2009
Posts: 6
Hi Sagar

Regarding the conversion process, follow the procedure given in :: http://retrotranslator.sourceforge.net/.
You should be able to port the smack library from jdk 1.5 to jdk 1.4 .

And regarding your other query, I ran the library on J2SE 1.4, where it ran fine.
I didnt try it on Java ME. But, newhow, you can give it a try there.
 
wood burning stoves
 
subject: Porting a source library in jdk 1.5 to jdk 1.4