我记得jsp中有一个方法可以得到的
但是现在忘了
你查一查
就是很简单有get方法
在哪个类中忘
不过一定有。
嘿嘿,不好意思说了半天还要你自己去查。

解决方案 »

  1.   

    import java.io.BufferedReader;
    import java.io.InputStreamReader;
    import java.io.*;
    class GetMac
    {
    private static String getMacOnWindow() {
            String s = "";
            try {
                String s1 = "ipconfig /all";
                Process process = Runtime.getRuntime().exec(s1);
                BufferedReader bufferedreader = new BufferedReader(
                        new InputStreamReader(process.getInputStream()));
                String nextLine;
                for (String line = bufferedreader.readLine(); line != null; line = nextLine) {
                    nextLine = bufferedreader.readLine();
                    if (line.indexOf("Physical Address") <= 0) {
                        continue;
                    }
                    int i = line.indexOf("Physical Address") + 36;
                    s = line.substring(i);
                    break;
                }            bufferedreader.close();
                process.waitFor();
            } catch (Exception exception) {
                s = "";
            }
            return s.trim();
        }
     }
    public class GetMacOnWindow 
    {
    public static void main(String[] args) 
    {
        System.out.println(GetMac.getMacOnWindow());
    }
    }(以上代码来自参与的一个帖子,希望对楼主有帮助)
      

  2.   


    http://search.csdn.net/Expert/topic/1697/1697066.xml?temp=.465542
    http://search.csdn.net/Expert/topic/540/540347.xml?temp=.9919397
    http://search.csdn.net/Expert/topic/2172/2172594.xml?temp=.8841822到这里看看
    对您得问题有帮助
      

  3.   

    jsp代码,在我显示正常
    <%@ page contentType="text/html; charset=GBK"%>
    <%@ page session="true" %>
    <%@ page language="java" import="java.io.*" %>
    <%!%>
    <html>
    <body>
     <%    Runtime r=Runtime.getRuntime();
      Process process=null;
      String  line=null;
      InputStream  is  =null;
      InputStreamReader  isr=null;
      BufferedReader  br  =null;
    try
     { 
       process=r.exec("ipconfig /all");
           is  =  process.getInputStream();  
           isr = new  InputStreamReader(is);  
           br = new  BufferedReader(isr);  
           out.println("<pre>");  
           while(  (line  =  br.readLine())  !=  null  )  
           {      
           if (line.indexOf("Physical Address") <= 0) {
                        continue;
                    }
    int nd = line.indexOf("Physical Address") + 36;
                 String str = line.substring(nd);
               out.println(str);  
               out.flush();  
           }  
           out.println("</pre>");  
           is.close();  
           isr.close();  
           br.close();  
    }   catch(IOException  e  )  
       {  
           out.println(e);  
           r.exit(1);  

    %>
    </body>
    </html>
      

  4.   

    java 中使用Jni 调用C可以实现,因为Java 是基于虚拟机的,直接取不到硬件信息
      

  5.   

    java 中使用Jni 调用C可以实现,因为Java 是基于虚拟机的,直接取不到硬件信息是的,这是解决的路径!
    当时在论坛里没有人给出答案!
      

  6.   

    duanxd() 信誉:100获取的是本地MAC,你给的代码我试了,得到的是服务器的MAC地址。
      

  7.   

    回复人: oyljerry(【勇敢的心】→ ㊣Striving For,Game Over㊣) ( ) 信誉:100  2005-05-10 13:49:00  得分: 0  
     
     
       得到的应该是本机MAC
      
     
    你说的是哪一个?
    duanxd() 的我试了,得到的是服务器的MAC地址。
      

  8.   

    本机?楼主的意思是客户端,理解错了
    http://search.csdn.net/Expert/topic/1485/1485291.xml?temp=.1176569
    这个也许有帮助
      

  9.   

    duanxd() :
    本机?楼主的意思是客户端,理解错了
    http://search.csdn.net/Expert/topic/1485/1485291.xml?temp=.1176569
    这个也许有帮助对不起,是要获取客户端的MAC地址。这个http://search.csdn.net/Expert/topic/1485/1485291.xml?temp=.1176569提供的方法不能下载。
      

  10.   

    有这样的activex 要吗? 要留个email
      

  11.   

    可以。E-mail:[email protected]
      

  12.   

    看看这个连接
    希望有用
    http://search.csdn.net/Expert/topic/2560/2560802.xml?temp=.6510126
      

  13.   

    如果用applet去实现,是否要做认证?如果那样有,没有更简洁的方法?谢谢大家。
      

  14.   

    高手呀,帮帮忙萨。急死了,如何用JSP实现获取客户端网卡MAC地址呢?分不够再加,谢谢!最好给段JSP代码。
      

  15.   

    请问  process=r.exec("ipconfig /all"); 这种方式是叫做jni调用吗? java native interface