• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Porting a source library in jdk 1.5 to jdk 1.4  RSS feed

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
author and iconoclast
Posts: 24203
40
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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?
 
Sheriff
Posts: 21463
97
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you perhaps using Iterable? Because Retroweaver explicitly states that it can have problems with that.
 
Nishant Suneja
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!