How to distribute an application that uses DLLs for 32-bit and 64-bit machines

I have an application that uses a third-party jar (utils.jar) that calls a third-party DLL (utils.dll). The jar file manages calls to the DLL, including the name of the DLL. There is a 32-bit version and a 64-bit version of the DLL.

Currently, the application can only run on 32-bit machines. When I try to run it on a 64-bit machine, it tells me

Can't load IA 32-bit .dll on a AMD 64-bit platform 

When I replace a 32-bit DLL with a 64-bit, it works fine. I don’t want to support two separate releases if I can avoid it (one uses a 32-bit library, and the other in a 64-bit library). Is there a way to create an application so that it can determine which version of the library it should use?

Our projects are built using Ant, although I can explore other alternatives if necessary.

+4
source share
3 answers

You need to create additional ant targeting so that it always creates the x32 and x64 versions of your application.

I do not want to support two separate issues

If your skript ant always produces both deliveries, that does not take a lot of effort.

+2
source

When you execute loadLibary, you can compose the library name using System.getProperty("os.arch") . This way you bind all the dlls and the corresponding version will be selected at runtime.

+1
source

To deploy applications to the Java desktop, it is best to install the application. using Java Web Start 1 . JWS runs on Windows, OS X, and * nix.

  • JWS provides many attractive features, including but not limited to pop-up screens, desktop integration, file associations, automatic updates (including lazy downloads and programmatic update control), separation of Aboriginal and other resource downloads on the platform, Java architecture or version, environment configuration runtime (minimum version of J2SE, runtime parameters, RAM, etc.), simple management of shared resources using extensions.

+1
source

Source: https://habr.com/ru/post/1493735/


All Articles