小编Sag*_*ave的帖子

哪个数据库最好是h2或sqlite for java?

我正在开发一个名为slambook的java小项目.需要一些建议,哪个数据库应该使用h2或sqlite.我的项目不处理客户端和服务器.. 该数据库提供更好的性能

java sqlite hsqldb

5
推荐指数
0
解决办法
5042
查看次数

如何获得机器的mac地址

我想得到机器的MAC地址..但是下面写的代码只显示互联网连接到我的机器的MAC地址,否则它将返回null ...我正在使用Windows 7

import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.net.UnknownHostException;

class test
{
    public static void main(String[] args)
    {
        InetAddress ip;
        try {
            ip = InetAddress.getLocalHost();

            System.out.println("The mac Address of this machine is :" + ip.getHostAddress());

            NetworkInterface network = NetworkInterface.getByInetAddress(ip);

            byte[] mac = network.getHardwareAddress();

            System.out.print("The mac address is : ");

            StringBuilder sb = new StringBuilder();
            for (int i = 0; i < mac.length; i++){
                sb.append(String.format("%02X%s", mac[i],(i< mac.length - 1)?"-":""));
            }

            System.out.println(sb.toString());

        } 
        catch (UnknownHostException e) {
            e.printStackTrace();
        } 
        catch …
Run Code Online (Sandbox Code Playgroud)

java

3
推荐指数
2
解决办法
1万
查看次数

标签 统计

java ×2

hsqldb ×1

sqlite ×1