Java:d​​ll之间的切换取决于系统架构(32/64) [英] Java : switching between dll depends on system architecture (32/64)

查看:173
本文介绍了Java:d​​ll之间的切换取决于系统架构(32/64)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Java程序使用一些DLL。由于这些嵌入式dll必须为特定的系统架构(32或64位)构建,所以我想制作一个方法/允许我的程序在32/64位版本的dll之间切换(或者如果程序运行则禁用库加载在64位系统上)



我希望有一个解决方案与制作两个版本的程序不同



提前感谢
Damien

解决方案

使用系统属性:



如果(x86.equals(System.getProperty(os.arch))){
// 32位
} else if( x64.equals(System.getProperty(os.arch))){
// 64位
}


I have a Java program uses some dlls. As these embeded dlls have to be built for a specific system architecture (32 or 64bits) I want to make a method/something that allow my program to switch between 32/64 bits version of dlls (or disable the library load if the program run on a 64 bits system)

I hope there is a solution different from making two versions of the program

Thanks in advance, Damien

解决方案

Use system properties:

if ("x86".equals(System.getProperty("os.arch"))) {
   // 32 bit
} else if ("x64".equals(System.getProperty("os.arch"))) {
   // 64 bit
}

这篇关于Java:d​​ll之间的切换取决于系统架构(32/64)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆