• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

compiling jdk1.5 code to jdk1.4 byte code

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i need to know how to convert a code written using jkd1.5 to jdk1.4 compliant byte code. we have somecode written in jdk1.5 and i have to deploy that application in oracle web application server which supports jdk1.4. Please let me know. Also please let me know how to use the ant task to do this.
any help asap is much appreciated
Thanks
Rashid
 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just a guess:

i think you can use this with javac
-target <release> Generate class files for specific VM version
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i know that javac can be used with target tag to do that. Please let me know some code examples how should i use it. can you also give some tips how to use with ant
Thanks
Rashid
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
That argument will let you compile JDK 1.4 bytecodes, but only if your code doesn't use any JDK 1.5 features. If you've got code that will only compile with JDK 1.5 then it will only run with 1.5.
 
Rashid Darvesh
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Ernest
So basically that mean if we have a code written with specific jdk1.5 features there is no way we can compile it to jdk1.4 compliant byte code. I have heard of some third party looks like retroweaver. They too have the same condition for this problem
Please let me know
Thanks
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had not heard of Retroweaver before. Sounds like it may help you out! Based on my few moments of looking at the manual, it doesn't sound like it will help you if the code uses any 1.5-specific APIs, but it does emulate essentially all of the new Tiger language features.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
tools like retroweaver take your 1.5 compliant Java source and transpile it into 1.4 compliant Java code. This can then be offered to a 1.4 compiler.
I don't know how effective they are, I can imagine some areas where transpilation can be extremely difficult if not impossible.
 
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeroen Wenting:
tools like retroweaver take your 1.5 compliant Java source and transpile it into 1.4 compliant Java code. This can then be offered to a 1.4 compiler.
I don't know how effective they are, I can imagine some areas where transpilation can be extremely difficult if not impossible.



Probably that kind of tools depends on the new features of Tiger you are using. If we are talking about generics or autoboxing I think the conversion may be posible, even "just" :roll: recoding / refactoring.
But if you are using Tiger's new packages and advanced classes I would not expect your code to be converted to something 1.4 compilable.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Like I said, some code converts better than other
Of course anything can be transpiled into something else given enough effort, effort that might be large enough to require human intervention and/or the use of large custom libraries to replace non-existent functionality in the language you're transpiling into.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic