奇怪的问题.
evicn 2003-05-19 01:54:06 以下的程序(没错)
但我不用JB新建一个project的时候,它是无论如何也不能运行
提示
Exception in thread "main" java.lang.NoClassDefFoundError: DaytimeClient/java
新建一个project的时候,却能run.我是菜鸟. 不知道为什么
// DaytimeClient
import java.net.*;
import java.io.*;
public class DaytimeClient
{
public static void main (String[] args)
{
String sHostName;
// Get the name of the server from the command line.
// No entry, use tock.usno.navy.mil
if (args.length > 0)
{
sHostName = args[0];
}
else
{
sHostName = "time.ien.it";
}
try
{
// Open a socket to Port 13.
// Prepare to receive the Daytime information.
Socket oSocket = new Socket(sHostName, 13);
InputStream oTimeStream = oSocket.getInputStream();
StringBuffer oTime = new StringBuffer();
int iCharacter;
// Fetch the Daytime information.
while ((iCharacter = oTimeStream.read()) != -1)
{
oTime.append((char) iCharacter);
}
// Convert Daytime to a string and output.
String sTime = oTime.toString().trim();
System.out.println("It is " + sTime + " at " + sHostName + ".");
// Close the stream and the socket.
oTimeStream.close();
oSocket.close();
}
catch(UnknownHostException e)
{
System.err.println(e);
}
catch(IOException e)
{
System.err.println(e);
}
}
}