import java.net.InetAddress;
import java.net.UnknownHostException;
class IpAddr {
public static void main(String arg[]) {
System.out.println("Hello Jagadeesh...>!!");
try {
InetAddress ia=InetAddress.getByName("www.facebook.com");
System.out.println(ia);
}
catch(UnknownHostException uhe) {
System.out.println("ip address of facebook is not found. :(");
}
}
}
在控制台中:运行时 E:\myworkspace\network_practice\src\stage1>javac IpAddr.java E:\myworkspace\network_practice\src\stage1>java IpAddr
Exception in thread "main" java.lang.NoClassDefFoundError: IpAddr
(错误名称:s tage1/IpAddr)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
E:\myworkspace\network_practice\src\stage1>cd..