Java to determine 32-bit or 64-bit, call a different DLL

Source: Internet
Author: User

Source: Java determines 32-bit or 64-bit, calling different DLLs

32 or 64 Java can be judged by getting Sun.arch.data.model

Implement an adaptive call DLL by placing a 32 or 64-bit DLL in a different directory

  Properties props = system.getproperties ();  String bits=string.valueof (props.get ("Sun.arch.data.model"));     = Imynative. class. GetResource ("/"). GetPath () + "DLL" +bits;  SYSTEM.OUT.PRINTLN (path);   // path=path.substring (1,path.length ()). Replace ("/", "\ \");  New File (path + "/mynative.dll");  SYSTEM.OUT.PRINTLN (path);   + "/mynative.dll");  Nativelibrary.addsearchpath ("MyNative.dll", Path);


JNA requires the following packages:

Jna.jar Platform.jar

:/files/wasp520/lib.rar

Java to determine 32-bit or 64-bit, call different DLLs (GO)

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.