2
votes

I am building a java application and copying some native dll's before packaging with java packager.

How can I determine in gradle if the build system is 32bit or 64bit so that I can copy the right dll files? At the moment I am manually setting a variable when I remember.

1
You create 2 packages. One for 32 bit and one for 64 bit. - Gilbert Le Blanc
Unfortunately I can't. I am not sure why as I haven't looked into it, but when packaging with Javapackager into an .exe (with inno setup) on a 64bit machine it will install but not run or start on 32bit. I assume it's to do with the .exe wrapper but am not sure yet. - Rob
@Rob: javapackager, apparently, can only create binaries for the current architecture, so you need to build the binary for 32 bit on a 32 bit architecture. - pupeno

1 Answers

2
votes

You can query system property os.arch to determine your operating system architecture and derive how whether you are on 32bit or 64bit OS

If you are concerned with your JVM ( you can run 32bit JVM on 64bit system) use sun.arch.data.model property

Use this task as an example how to access these values

task printProps << {
    println System.properties['os.arch']
    println System.properties['sun.arch.data.model']

}

More information could be found at the below links:

How can I tell if I'm running in 64-bit JVM or 32-bit JVM (from within a program)?

How to find the OS bit type