JAVA judge 32 bit or 64 bit, call different Dll__java

Source: Internet
Author: User
Java Judge 32 bits or 64 bits, call a different DLL

By getting Sun.arch.data.model, you can tell whether it's 32 or 64 Java

A 32 or 64-bit DLL is placed in a different directory to implement an adaptive calling DLL

Properties props = System.getproperties ();
String bits=string.valueof (Props.get ("Sun.arch.data.model"));

String Path = IMyNative.class.getResource ("/"). GetPath () + "DLL" +bits;
SYSTEM.OUT.PRINTLN (path);
Path=path.substring (1,path.length ()). Replace ("/", "\ \");
File File = new file (path + "/mynative.dll");
SYSTEM.OUT.PRINTLN (path);
System.load (path + "/mynative.dll");
Nativelibrary.addsearchpath ("MyNative.dll", Path);

JNA requires the following packages:

Jna.jar Platform.jar

Download Address:/files/wasp520/lib.rar

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.