try{ ServerSocket ss = new ServerSocket(8888); while(true) { Socket s = ss.accept(); PrintWriter pw = new PrintWriter(s.getOutputStream()); pw.println("HTTP/1.1 200"); pw.println("Content-type : text/html\n"); pw.println("Hello !!"); pw.close(); } } catch(IOException e) {}