title: Communication between applet and CGI in java
body: <p>I have applet with such start() code:</p>
  
  <pre><code>public void start() {
          try {
              URL cgiUrl = new URL("http://localhost:8080/cgi_lib/UsersCGI.exe?someText");
              URLConnection con = cgiUrl.openConnection();
              con.setDoOutput(true);
              con.setDoInput(true);
              OutputStream out = con.getOutputStream();
              DataInputStream din = new DataInputStream(con.getInputStream());
              DataOutputStream dout = new DataOutputStream(out);
              dout.writeUTF("Hello");
              String receivedString = din.readUTF();
              this.out=receivedString;
          } catch (MalformedURLException e) {
              e.printStackTrace();
          }
          catch (IOException ex){
              ex.printStackTrace();
          }
      }
  </code></pre>
  
  <p>And CGI written on java and compiled to .exe (using launch4j):</p>
  
  <pre><code>    public class UsersCGI {
          public static void main(String[] args) {
              System.out.println(Arrays.toString(args));
          }
      }
  </code></pre>
  
  <p>So, I have error: </p>
  
  <blockquote>
    <p>"java.io.UTFDataFormatException: malformed input around byte 0"</p>
  </blockquote>
  
  <p>at line </p>
  
  <blockquote>
    <p>String receivedString = din.readUTF();</p>
  </blockquote>
  
  <p>What I did wrong?</p>