简体   繁体   English

如何在Java和C ++中获取硬件ID

[英]How to get hardwares id in java and c++

I want to get hardware ids of processor, motherboard and harddisk from java and c++. 我想从Java和C ++获取处理器,主板和硬盘的硬件ID。 Please help me in this. 请帮助我。 In all oses like windows,linux,mac os. 在所有Windows,Linux,Mac OS中。

That's a tough topic. 这是一个很难的话题。 I would suggest, if you are brave enough, to use Solid , which is KDE's hardware device framework, which works under Linux/Win/Mac. 如果您足够勇敢,我建议您使用Solid ,这是KDE的硬件设备框架,可以在Linux / Win / Mac下运行。 But you have to take into consideration that Solid will require a lot of extra dependencies, ie KDE and Qt libraries (some of them), along with the underlying libs which deal with hardware access, so the size of your whole project will increase a lot . 但是您必须考虑到Solid将需要很多额外的依赖项,例如KDE和Qt库(其中一些)以及用于处理硬件访问的基础库,因此整个项目的规模将增加很多 KDE guys are working, as we speak, to a deep refactoring of their libraries, to get smaller and indipendent subset of their libs, so in a near future Solid will be available with less dependencies than now. 正如我们所说的,KDE团队正在努力对其库进行深度重构,以获取更小的且独立的库子集,因此在不久的将来,Solid将会比现在具有更少的依赖项。 The question is: is it worth to pull such big and extra dependencies to your project? 问题是:是否值得将如此大的额外依赖项拖到您的项目中? Are you ready to afford the technical difficulties about ship/deploy those libs on each platform? 您准备好承担在每个平台上运送/部署这些库的技术难题了吗? If the answer is yes, then use it; 如果是,则使用它;否则,请使用它。 otherwise, you should try something different (and I have no idea other than Solid), or write your thin&light library which wraps the OS-specific calls to get those informations from the hardware. 否则,您应该尝试不同的方法(除了Solid,我别无选择),或者编写您的Thin&light库,其中包含特定于操作系统的调用,以从硬件中获取这些信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM