title: MASM error A2088, but only when assembled from within Java
body: <p>I'm following Jack Crenshaw's guide on building a compiler, translating from pascal and 68k to java and x86. The actual assembly has been mostly smooth sailing, with only a few exceptions. But I tried integrating assembling and linking the generated assembly into the java program using Runtime.getRuntime().exec(). For some reason, the assembler throws an error when called from java, but works fine from the command line when I invoke it myself. Here's the relevant java code:</p>
  
  <pre><code>        String s = "";
          Process p = Runtime.getRuntime().exec("C:\\masm32\\bin\\ml /c /Zd /coff \"" + src.getAbsolutePath() + "\"");
          p.waitFor();
          BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
          while ((s = stdInput.readLine()) != null) {
              System.out.println(s);
          }
  
          System.out.println("\n");
  
          p = Runtime.getRuntime().exec("C:\\masm32\\bin\\Link /SUBSYSTEM:CONSOLE \"" + obj.getAbsolutePath() + "\"");
          p.waitFor();
          stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
          while ((s = stdInput.readLine()) != null) {
              System.out.println(s);
          }
  
          System.out.println("\n");
  
          p = Runtime.getRuntime().exec("\"" + exe.getAbsolutePath() + "\"");
          p.waitFor();
          stdInput = new BufferedReader(new InputStreamReader(p.getInputStream()));
          while ((s = stdInput.readLine()) != null) {
              System.out.println(s);
          }
  </code></pre>
  
  <p>the error</p>
  
  <pre><code>Assembling: C:\asm\tobecompiled.asm
  C:\asm\tobecompiled.asm(1) : error A2088: END directive required at end of file
  </code></pre>