java
import java.io.*;import java.net.*;
import java.util.*;
class SocketDemo
{
public static void main(String[] args) throws Exception
{
Socket s = new Socket("221.7.225.50",1007);
BufferedReader buf = new BufferedReader(new InputStreamReader(System.in));
BufferedWriter bwf = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
String line = null;
while((line=buf.readLine())!=null)
{
bwf.write(line);
}
BufferedReader bufg = new BufferedReader(new InputStreamReader(s.getInputStream()));
byte[] by = new byte[1024];
int len = bufg.read();
System.out.println(new String(by,0,len));
s.close();
buf.close();
bwf.close();
bufg.close();
}
}
class ServerSocketDemo
{
public static void main(String[] args) throws Exception
{
ServerSocket ss = new ServerSocket(1007);
Socket s = ss.accept();
BufferedReader buf = new BufferedReader(new InputStreamReader(s.getInputStream()));
BufferedWriter bwf = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
String line = null;
while((line=buf.readLine())!=null)
{
bwf.write(line);
System.out.println(line.toUpperCase());
s.shutdownOutput();
}
s.close();
buf.close();
bwf.close();
}
}建立一个文本转换器。,。。。。。出现这个错误Exception in thread "main" java.lang.NoClassDefFoundError: SocketServerTest
Caused by: java.lang.ClassNotFoundException: SocketServerTest
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
Could not find the main class: SocketServerTest. Program will exit.
java --------------------编程问答-------------------- SocketServerTest这个类在哪 --------------------编程问答-------------------- SocketServerTest这个只是文件名呀。。。。在一个文件中定义两个类。。。。。实现建立一个文本转换器。。。。
补充:Java , Java相关