• 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:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Specify Java Version in build.xml

 
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I want to build a jar file with 1.4 version of java, i have both 1.4 and 1.5 installed on my machine and 1.5 is the default java jre and everytime it complies it uses java 1.5 is there a way we can specify the java version of compiler in the build.xml in ant process. or is there any other way so that ant uses 1.4 for compilation.

I think we can do this using the build.properties file for ANT but have no clue of this can anybody help me in this.


Thanks
Harish
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can set your JAVA_HOME in the ant script (or as you say through build.properties file) in order to pick up the JDK you want for that build
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For the <javac> task, set the source and target properties. Example:

 
Harish Tam
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got it after some time.

This is what you need to specify while doing javac in ANT build file

<javac srcdir="${src.dir}" destdir="${dist.dir.classes}" executable="D:\j2sdk1.4.2_05\bin\javac" compiler="javac1.4"/>

Thanks
Harish
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic