I am currently coding a java server in the vi text editor using a knoppix linux system. I have used the following code.
import java.net.*;
import java.io.*;
public class Server {
public static void main(String[] ar) {
int port = 6666;
try {
ServerSocket ss = new ServerSocket(port);
System.out.println("Waiting for a client...");
Socket socket = ss.accept();
System.out.println("Got a client
... !");
System.out.println();
InputStream sin = socket.getInputStream();
OutputStream sout = socket.getOutputStream();
DataInputStream in = new DataInputStream(sin);
DataOutputStream out = new DataOutputStream(sout);
String line = null;
while(true) {
line = in.readUTF();
System.out.println("The client just sent me this line : " + line);
System.out.println("Waiting for the next line...");
System.out.println();
}
} catch(Exception x) {
x.printStackTrace();
}
}
}
I am getting the following errors:
No encode delegate for this image format "java.net.*"
No encode delegate for this image format ".io.*"
line 4: public: command not found
line 6: syntax error near expected token "("
line 6: public static void main(String[] ar) {
Does anyone know what is causing these errors and what I can do to fix them?