File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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: 19682
    
  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: 14116
    
  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: 19682
    
  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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: how to get hard disk serial number using java