• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • paul wheaton
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Ron McLeod
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Tim Holloway
  • Carey Brown
  • salvin francis

Specify Java Version in build.xml

 
Ranch Hand
Posts: 71
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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: 3281
8
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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
  • 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
  • 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
 
That's a very big dog. I think I want to go home now and hug this tiny ad:
Enterprise-grade Excel API for Java
https://products.aspose.com/cells/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!