This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Hands On Software Engineering with Python and have Brian Allbey on-line!
See this thread for details.
Win a copy of Hands On Software Engineering with Python this week in the Jython/Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Liutauras Vilda
Sheriffs:
  • Tim Cooke
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Ron McLeod
  • Ganesh Patekar
  • salvin francis
Bartenders:
  • Tim Holloway
  • Carey Brown
  • Stephan van Hulst

getHardwareAddress returning null with JDK 6 Update 22 enabled browser  RSS feed

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using the follwoing code and calling it in an applet. It used to work completely fine when I used with browser with JRE 6 Update 21. However, the code is now returning null for all browsers that support JRE 6 Update 22. Here is the code -

 
Nitin Sinha
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
this is a specific business requirement for which I need hardwareaddress.
thats why i posted the code.
 
Sheriff
Posts: 21550
100
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What does it print if you try that code on a command line? I tried it (after removing the remaining call to checkValidMAC), and the only null MAC address was that of my "lo" adapter - which is the loopback adapter, and not really a physical device.
 
Nitin Sinha
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
TRY THIS CODE THEN -

 
Sheriff
Posts: 23963
50
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That code doesn't compile for me because there's no checkValidMAC method declared anywhere.

By the way you appear to be in the habit of cross-posting your questions on the Oracle forum. Please read this: BeForthrightWhenCrossPostingToOtherSites.

 
Rob Spoor
Sheriff
Posts: 21550
100
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Again, if I run that code after changing line 43, I see all my network adapters - lo, two VMware virtual adapters and my actual network adapter (well, the one that isn't disabled - I have two). The MAC address (LAN ID) printed at the bottom is my actual MAC address. So I'll ask you again - what is the output when you run it?
 
Marshal
Posts: 62180
193
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Never, never write == false or == true.
Those lines with multiple || checks are too long to read; they ought to have newlines in to break them up.
The multiple || look very inelegant. See if you can create a regular expression to match the multiple possibilities.
 
You know it is dark times when the trees riot. I think this tiny ad is their leader:
RavenDB is an Open Source NoSQL Database that’s fully transactional (ACID) across your database
https://coderanch.com/t/704633/RavenDB-Open-Source-NoSQL-Database
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!