• 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

How to define an ant task for java version is 1.6.0_05 or higher

 
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How to define an Ant task to enforce that the java version should be 1.6.0_05 or higher?

The following build.xml fails with the error message:
BUILD FAILED
C:\workspace\Test_TIJ4\build.xml:51: The following error occurred while executing this line:
C:\workspace\Test_TIJ4\object\build.xml:29: J2SE6 required

build.xml (partial, not the entire file)
 
author
Posts: 5856
7
Android Eclipse IDE Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On line 9, the "unless" clause should check for "version1.6" - that is the property that the condition sets.

If you want to allow any 1.6 or 1.7 JVM, you could use this condition:



According to the docs, the ant.java.version property is only two parts: http://ant.apache.org/manual/properties.html#built-in-props

Why do you want to disallow a 1.6 JVM prior to 1.6.0_05?
 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to allow any 1.6 or 1.7 JVM for jdk 1.6.0_05 or higher.
The ant version is 1.7.0 (I can't use a newer version).
The build.xml file is changed as per your advice and the error message is now:
BUILD FAILED
C:\workspace\Test_TIJ4\build.xml:51: The following error occurred while executing this line:
C:\workspace\Test_TIJ4\object\build.xml:21: equals doesn't support the "string" attribute

 
albert kao
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The build.xml file can be compiled by changing to:
 
Peter Johnson
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
Oops, sorry, when I started to write the code I meant to use the <substring> condition but switched to <equals> and then forgot to change the property names.

By the way, it is very distracting to quote the entire previous post when replying, so I removed the quotes for you.
 
reply
    Bookmark Topic Watch Topic
  • New Topic