//java实现获得本机IP
/*
* Main.java
*
* Created on 2007年6月6日, 下午11:09
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
package getlocalhost;
/**
*
* @author Administrator
*/
public class Main {
/** Creates a new instance of Main */
public Main() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
java.net.InetAddress myIp=null;
try
{
myIp=java.net.InetAddress.getLocalHost();
}
catch(java.net.UnknownHostException e)
{
}
System.out.println(myIp);
}
// TODO code application logic here
}