I would like to get the number of availableProcessors from with my Ant build script (i.e. value that is returned from Runtime.getRuntime().availableProcessors(). Is there an existing property that contains this value or do I have to write a custom ant task?
A:
I never heard about such a property, thus I think you should write your custom task.
Manu
Manuel Selva
2009-07-23 08:36:32
A:
The JVM does not provide such a property and neither does ant. Instead of writing a custom task you could do one of the following:
- Write a Java class that prints the number of processors to standard output. Use the java task with the outputproperty attribute to set the value to a property for use in ant.
- If you are only ever building one a single platform use the exec task to call something native that prints the number of processors to standard output. As above use the outputproperty attribute to set the value to a property for use in ant.
Mark
2009-07-23 08:43:42
Runtime.getRuntime().availableProcessors() is provided by the JVM
dfa
2009-07-23 08:47:13
A method call is not a property, hence you need code to get to it.
Thorbjørn Ravn Andersen
2009-07-23 08:59:00