ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hakan Koseoglu" <hakan.koseo...@gmail.com>
Subject Re: Print exact version of jvm (java -version)
Date Thu, 08 Jun 2006 11:34:22 GMT
On 6/8/06, Mikael Petterson (KI/EAB) <mikael.petterson@ericsson.com> wrote:
> How can I print what compiler is used ( exact version like 'java
> -version') when compiling?
Probably the easiest way is creating a new task stuffed with all sorts
of information you want to log and calling it as a task:

The following compiles but I haven't tested it.


---8<----------------------------------------------
package org.isageek.m1fcj.dummy;

import org.apache.tools.ant.*;

public class SysInfo extends Task {

    public void execute() {
     // iterator over the conditions
    	   try
    	    {
    	      log("java class version: "+System.getProperty("java.class.version"));
    	      log("java vendor:        "+System.getProperty("java.vendor"));
    	      log("java vendor url:    "+System.getProperty("java.vendor.url"));
    	      log("java version:       "+System.getProperty("java.version"));
    	      log("OS architecture:    "+System.getProperty("os.arch"));
    	      log("OS name:            "+System.getProperty("os.name"));
    	    }
    	    catch (Throwable t)
    	    {
    	    	log ("ooops...");
    	    }    	
    }
}

---8<----------------------------------------------
-- 
Hakan (m1fcj)

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message