ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marion, Patrick" <patrick.mar...@certive.com>
Subject RE: How can ant detect it is running on a 64 bit machine?
Date Mon, 17 Oct 2005 17:26:18 GMT
Thank you all for your suggestions.  Indeed I cannot rely on the JVM
currently running to tell me whether the machine architecture itself is
64bit, since a 32bit JVM can run on a 64Bit machine.

All I really need (I think) is a property (such as sun.arch.data.model) set
on _all_ platforms that would give me this information.  uname unfortunately
is not portable, so I'd rather avoid this route. Also "sun.arch.data.model"
returns 32 on my solaris (an UltraSPARC-IIi which I understand to be 64bit),
it also returns the same value on linux (32, and 64) machines... This
doesn't give me a warm and fuzzy feeling about its trustworthiness.

I am running Ant 1.6.2; could it be that more recent versions handle this?

P.

-----Original Message-----
From: Robert Clark [mailto:robert.clark@quest.com]
Sent: Friday, October 14, 2005 10:24 AM
To: Marion, Patrick
Cc: user@ant.apache.org
Subject: Re: How can ant detect it is running on a 64 bit machine?


On Thursday October 13, 2005 08:06 pm, "Marion, Patrick" 
<patrick.marion@certive.com> wrote:
> Problem:
> 	have ant tell me whether I am running on a 64 bit architecture.
>
> I thought the solution was:
>
> 	check for the value of the "os.arch" property.
>
> Unfortunately, if I can make something out of the value returned on
> Windows ("amd64) I can't on Linux (it returns "i386" which is
> identical to the one on a 32 bit machine); solaris sparc just
> returns "sparc".  The only os.* properties which seem to be
> available to ant at start time seem to be: "version", "name", and
> "arch".

If you are running a Sun (or IBM, I believe) 1.4+ VM. You can check 
the system property "sun.arch.data.model". This will be "32" for a 32 
bit VM and "64" for a 64 bit VM.

For earlier versions of the above JVMs, you could reasonably assume 
that they are 32-bit. 

However, that still means that you have to figure what to do for other 
VMs and platforms.

- Rob

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


Mime
View raw message