Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8861289
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:27:38+00:00 2026-06-14T15:27:38+00:00

Right now I am using this code to retrieve the MAC Address of a

  • 0

Right now I am using this code to retrieve the MAC Address of a system.

command = "cmd.exe /c ipconfig /all";
Process p = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));

This works fine when the user has defined a ‘Path’ in the environment variable with the value ‘Systemroot/system32’ but not without this.
So what I am trying to do is use this

command = "cmd.exe %systemroot%/system32/ipconfig /all";
Process p = Runtime.getRuntime().exec(command);
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));

But this is not retrieving the MAC Address at all.

Can anyone please let me know what is wrong here or how to retrieve MAC address, the code for which is compatible in java 5 & above?
Is there any alternate solution?
The getHardwareAddress() doesn’t work in java 5. I saw this in many posts, which doesn’t suit to my app. My app is compatible to all tomcat and all java versions.
Please help…

I referred to and followed this How do I set environment variables from Java? also but without the environment variable the MAC address doesn’t get read from the system.
Any other suggestions please?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T15:27:39+00:00Added an answer on June 14, 2026 at 3:27 pm

    You can get the value of an environment variable using System.getenv, so you could try something along the lines of

    File sysRoot = new File(System.getenv("systemroot"));
    File ipconfig = new File(new File(sysRoot, "system32"), "ipconfig");
    String[] command = new String[] { ipconfig.getAbsolutePath(), "/all" };
    Process p = Runtime.getRuntime().exec(command);
    BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
    // read all output from br, then p.waitFor()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Right now I'm using the following line of code to retrieve an Underscore template
Right now I'm using this code to get the size of a folder: NSArray
Right now I am using this on my string substr($row->review[$i] , 0, 120) but
I'm using this tutorial right now and I got it working perfectly, but my
So right now I'm using something like this in C#: Response.Write(Server.HtmlEncode(line)); This will grab
I can't find this anywhere in the Ehcache docs. Right now I'm using this
We are using a Java EE application and we are right now using Informix
Right now I am using sqlite within a ios application, and I want to
Right now I am using a custom list view and I am inflating an
Right now I am using std::pair to represent a 2d point in c++. However,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.