2

Possible Duplicate:
How do I detect which kind of JRE is installed — 32bit vs. 64bit
How can I tell if I'm running in 64-bit JVM or 32-bit JVM?

I have a signed Java applet that utilizes installed third party DLL's for use of a card scanner component in my Java application. On 64 bit machines there are a few libraries that are intended to be used for 64 bit architectures as the original versions of these libraries only run on x86.

The problem is that they are named differently...

library.dll

and on x64 I should be using...

library64.dll

I have to call loadLibrary to load the appropriate library by name in my applet, however to load the right one I need to predetermine the system architecture. I know that I could just catch an UnsatisfiedLinkError but that is really ugly and I want to avoid that if possible. I also can't presume where the library was installed to.

Any ideas how to figure this out from a Java application?

Community
  • 1
  • 1
maple_shaft
  • 10,435
  • 6
  • 46
  • 74

1 Answers1

6

You can Use SystemProperties to get the information.

System.getProperty("os.arch"); //Operating system architecture
Asif
  • 4,980
  • 8
  • 38
  • 53
  • Thank you... this worked perfectly. I understand that the JVM installation couldn't load 64 bit binaries, but I was more concerned with finding out the system architecture to be safe. – maple_shaft Jun 06 '12 at 11:24