|
From: Leif M. <le...@ta...> - 2006-05-16 22:34:28
|
Richard,
Download the source distribution and take a look at the build.xml in
the root
directory. It does exactly this. If you want to see an example of it
being done
in Java, then take a look at the source of the WrapperManager class in the
generateDetailedNativeLibraryBaseName method. The JVM bits are accessed
as follows:
m_jvmBits = Integer.getInteger( "sun.arch.data.model", -1
).intValue();
Note that the property does not exist on all JVMs.
Cheers,
Leif
Richard Emberson wrote:
> I have to support solaris, linux and windows on
> 32 and 64 bit machines.
> The wrapper executable and native library comes in
> 32 and 64 bit versions for those OSs.
> What I need is the ability during an installation
> to know what the machine (the hardware) architecture
> is, 32 or 64 bit. I need to be able to know this
> from within a java process (actually an Ant task).
> I discovered today on my 64 bit workstation that if
> I run java 1.4.x, a 32 bit java, then the system
> property os.arch has the value i386 but if I run java
> 1.5.x the os.arch has the value amd64 --- os.arch
> does not give the hardware architecture but rather
> the java vm architecture. In order to install the
> correct version of the wrapper executable and
> native libaray I need the true hardware architecture
> independent of what jvm I will be running.
> Any thoughts as to how to get this information
> using just java?
>
> Richard
>
|