This week's book giveaway is in the Testing forum.
We're giving away four copies of Data Structures the Fun Way: An Amusing Adventure with Coffee-Filled Examples and have Jeremy Kubica on-line!
See this thread for details.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

harddisk serial number

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
How i get the hardeware details like
network card number and serial number of harddisk of the computer using a java application.
 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I dont think there is a way of getting the hard drive serial or network adapter address directly.
If you are running windows you can get the hard drive number, but the same code wont necessarily work on linux, etc.
Here is what to do:
The following code will create a file called serial.out which should contain the hard drive serial.

You will need to read the serial from the file, but this can be achieved using a BufferedReader.

Hope this helps
Dave
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The operating system is responsible for maintaining the state of hardware, and it's device driver code that reports things like hardware serial numbers. Since this stuff is usually written in C/C++, the best Java can do is put a face on platform-dependent processes.
There are initiatives out there designed to provide services to device drivers so that they report their properties according to standard protocols, such as CIMOM (Common Information Model Object Manager) or WBEM (Web-Based Enterprise Management). Jini addresses this approach generally, while [http://www.jiro.com]Jiro[/url] focusses Jini's infrastructure on storage management.
That's going to be a much more complex picture if and when it does emerge. Getting a serial device off a disk in a platform-independent way is, under the covers, a lot more work than it sounds like.
------------------
Michael Ernest, co-author of: The Complete Java 2 Certification Study Guide
 
pradeep kumar k
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried the code and i got the exception:
java.io.IOException: CreateProcess: vol > serial.out error=2 at java.lang.Win32Process.create(Native Method) at java.lang.Win32Process.<init>(Win32Process.java:66) at java.lang.Runtime.execInternal(Native Method) at java.lang.Runtime.exec(Runtime.java:551)
at java.lang.Runtime.exec(Runtime.java:418)
at java.lang.Runtime.exec(Runtime.java:361)
at java.lang.Runtime.exec(Runtime.java:325)
at serial.main(serial.java:14)
 
I can't beleive you just said that. Now I need to calm down with this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic