aspose file tools*
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
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: 19718
    
  20

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: 14266
    
  21

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 8 API documentation
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

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