JAVA无法做么,我主要想针对LIUNX,但LIUNX下的C我又不会,想用JAVA跨平台来实现,有没有好的解决办法

解决方案 »

  1.   

    到下面的网址看看,可能对你有帮助。
    http://www.ccw.com.cn/htm/app/aprog/01_5_22_4.asp
      

  2.   

    to yishanjushi(伊行) 
    我看JDK中关于Properties的文档,他没有关于硬件的信息
      

  3.   

    import java.util.*;public class Property {
      public static void main(String[] args) {
        System.out.println(new Date());
        Properties p = System.getProperties();
        p.list(System.out);
        System.out.println("--- Memory Usage:");
        Runtime rt = Runtime.getRuntime();
        System.out.println("Total Memory = "
                           + rt.totalMemory()
                           + " Free Memory = "
                           + rt.freeMemory());
      }
    }可以看到系统环境及cpu型号
    其他的我就不晓得了
      

  4.   

    硬盘信息以及网卡的MAC地址好像只有通过JNI方法实现
      

  5.   

    通过shell程序应该可以!linux有linux的shelldos有dos的shell
      

  6.   

    得到网卡的MAC地址很容易的,你在这里面搜索一下就有了,
      

  7.   

    Java既然被设计来跨平台,自然不会轻易提供这些东东,即使提供了,其底层也是使用JNI来实现,所以不如自己写JNI来得痛快
      

  8.   

    而且估计用C/C++在Linux上获得系统信息的代码网上多的是,找来,简单的封装一下,完事
      

  9.   

    呵呵,这些东东好象是没有提供的,只有用JNI
      

  10.   

    呵呵!我用上面的代码测试了我的cpu是486,痛苦啊!
      

  11.   

    求教:什么是JNI?能否具体一点?
      

  12.   

    捷迅软件(苏州)有限公司,Agile Software Corp(Nasdaq 代码: AGIL)研发中心。总部位于美国硅谷,是世界最大的PLM(产品生命周期管理)软件供应商之一,被MSI列为“全球百强软件供应商”。现委托苏州立达人力资源服务有限公司猎取Java高级程序员和系统分析员
    联系:[email protected]
      

  13.   

    学习ing 
    帮楼主顶
    不用给分
    义务服务
      

  14.   

    █████████
    █┏━━━━━┓█
    █★          ★█
    █    ☆  ☆    █
    █              █
    █ 〖初窥Java〗 █
    █ 【虚心学习】 █
    █★          ★█
    █┗━━━━━┛█
    █████████
      

  15.   

    zcjl朋友的结果好像是JAVA虚拟机的系统信息
      

  16.   

    /**
    根据机器的名称或者IP地址得到网卡的MAC地址
    */
    import java.io.*;public class  GetMac
    {
        //通过IP获取网卡地址
    private String getMacAddressIP(String remotePcIP){
          String str="";
          String macAddress="";
          try {
               Process pp= Runtime.getRuntime().exec ("nbtstat -A " + remotePcIP);
               InputStreamReader ir = new InputStreamReader(pp.getInputStream());
               LineNumberReader input = new LineNumberReader (ir);
               for (int i = 1; i <100; i++)
                  {
                   str=input.readLine();
                   if (str!=null)
                     {
                       if(str.indexOf("MAC Address")>1)
                         { macAddress=str.substring(str.indexOf("MAC Address")+14,str.length());
                           break;
                        }
                     }
                  }
              }
          catch (IOException ex) {}
          return macAddress;
      }
      //通过机器名获取网卡地址
      private String getMacAddressName(String remotePcIP){
          String str="";
          String macAddress="";
          try {
               Process pp= Runtime.getRuntime().exec ("nbtstat -a " + remotePcIP);
               InputStreamReader ir = new InputStreamReader(pp.getInputStream());
               LineNumberReader input = new LineNumberReader (ir);
               for (int i = 1; i <100; i++)
                  {
                   str=input.readLine();
                   if (str!=null)
                     {
                       if(str.indexOf("MAC Address")>1)
                         { macAddress=str.substring(str.indexOf("MAC Address")+14,str.length());
                           break;
                        }
                     }
                  }
              }
          catch (IOException ex) {}
          return macAddress;
      }
    public static void main(String[] args) 
    {
            GetMac getmac;
            getmac=new GetMac();
    String mac="";
            mac=getmac.getMacAddressIP("10.67.0.6");
            System.out.println(mac);
            mac=getmac.getMacAddressName("gxy ");
            System.out.println(mac);
    }
    }
      

  17.   

    上面的代码还是通过调用nbtstat -a命令实现的
    java本身是不提供这类要求的支持!
    因为底层是c/c++的领域