wood burning stoves 2.0*
The moose likes Java in General and the fly likes how to get hard disk serial number using java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to get hard disk serial number using java" Watch "how to get hard disk serial number using java" New topic
Author

how to get hard disk serial number using java

ahmed elshal
Greenhorn

Joined: Jan 15, 2011
Posts: 6
i need java code that get the hard disk serial number
Joshua Barrett
Greenhorn

Joined: Sep 08, 2010
Posts: 27
NOTACODEMILL
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

You'll need JNI for this, as Java doesn't provide access to this low-level information. Check out this.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14074
    
  16

You are not the first one who is asking this question. If you do a search, you'll find older topics about this. For example:

How to read hard disk physical serial number?

Get hard disk serial key

How to get DiskID (contains some code with a solution)

Get Serial number of exernal hard disk/Thumbdrive using java code &work for both linux and windows

Hard disk serial number

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19656
    
  18

I do believe the code in that thread returns the partition serial number as assigned by Windows, not the physical hard drive serial number. This page mentions the difference:
This function returns the volume serial number that the operating system assigns when a hard disk is formatted. To programmatically obtain the hard disk's serial number that the manufacturer assigns, use the Windows Management Instrumentation (WMI) Win32_PhysicalMedia property SerialNumber.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to get hard disk serial number using java
 
Similar Threads
Get Serial number of exernal hard disk/Thumbdrive using java code &work for both linux and windows
How to read hard disk physical serial number?
Hard disk serial number
NIC address
To find the hard disk serial number