两个问题:如何获得、设置系统变量如java_home,如何获得网卡mac地址 可以通过system.getProperites() 获得系统变量, 不能直接设置(可以通过jni 实现)mac 的不知道 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 MAC地址只能通过本地代码得到。 classpath:System.out.println(System.getProperty("java.class.path")); http://expert.csdn.net/Expert/topic/2854/2854297.xml?temp=.6320307 java.util.Enumeration en = java.net.NetworkInterface.getNetworkInterfaces(); java.util.Enumeration enA = null; java.net.NetworkInterface netIf = null; while (en.hasMoreElements()) { netIf = (java.net.NetworkInterface)en.nextElement(); System.out.print(netIf.getName() + " : "); enA = netIf.getInetAddresses(); while (enA.hasMoreElements()) { java.net.Inet4Address ip = (java.net.Inet4Address)enA.nextElement(); System.out.println(ip.getHostAddress()); } } import java.net.InetAddress; import java.net.UnknownHostException; public class GetIP { static public void main(String[] args) { try { InetAddress address = InetAddress.getByName(args[0]); System.out.println(args[0]+" : "+address.getHostAddress()); } catch(UnknownHostException uhe) { System.err.println("Unable to find: "+args[0]); } } } List<Object> list=new ArrayList<String>()错误? JNI的findclass找不到类 iReport + jasperReports的问题啊. 方法中的内部类在引用方法中的成员变量时,为什么要定义为final? 我想将自己定义的时间+到数据库中怎么+? 求翁恺JAVA视频 关于多线程中死锁的问题 使用jmf播放mp3遇到怪事 新手!想要一个计算器程序来玩玩! 怎么在java中使用paint或诸如此类的?(在线等待) 怎么在java里调用系统命令或者自己写的exe文件呢 请问哪里有AIX5.1下的j2sdk开发包下载
System.out.println(System.getProperty("java.class.path"));
java.util.Enumeration enA = null;
java.net.NetworkInterface netIf = null;
while (en.hasMoreElements()) {
netIf = (java.net.NetworkInterface)en.nextElement();
System.out.print(netIf.getName() + " : ");
enA = netIf.getInetAddresses();
while (enA.hasMoreElements()) {
java.net.Inet4Address ip = (java.net.Inet4Address)enA.nextElement();
System.out.println(ip.getHostAddress());
}
}
import java.net.UnknownHostException;
public class GetIP {
static public void main(String[] args) {
try {
InetAddress address = InetAddress.getByName(args[0]);
System.out.println(args[0]+"
: "+address.getHostAddress());
}
catch(UnknownHostException uhe) {
System.err.println("Unable to find: "+args[0]);
}
}
}