title: Expected command error trying to embed NetLogo
body: <p>I am trying to embed NetLogo in a little personal project but am stuck after the first example. I managed to build and test this example:</p>
  
  <p><a href="https://github.com/NetLogo/NetLogo/wiki/Controlling-API#example-embedding" rel="nofollow">https://github.com/NetLogo/NetLogo/wiki/Controlling-API#example-embedding</a></p>
  
  <p>But now I'd like to get rid of reading the example «fire» file. This is what I did:</p>
  
  <pre><code>import org.nlogo.lite.InterfaceComponent;
  public class TestNetLogo {
    public static void main(String[] argv) {
      try {
        final javax.swing.JFrame frame = new javax.swing.JFrame();
        final InterfaceComponent comp = new InterfaceComponent(frame);
        java.awt.EventQueue.invokeAndWait(
      new Runnable() {
        public void run() {
          frame.setSize(800, 600);
          frame.add(comp);
          frame.setVisible(true);
        }});
          System.out.println("here");
          comp.command("breed [turtles turtle]");
          System.out.println("there");
      }
      catch(Exception ex) {
        ex.printStackTrace();
      }
    }
  }
  </code></pre>
  
  <p>Replacing <code>"breed [turtles turtle]"</code> with an empty string works, but with a non trivial string, this is what I get:</p>
  
  <pre><code>Expected command. at position 33 in
      at org.nlogo.compiler.CompilerExceptionThrowers$.exception(CompilerExceptionThrowers.scala:26)
      at org.nlogo.compiler.ExpressionParser.parseStatement(ExpressionParser.scala:83)
      at org.nlogo.compiler.ExpressionParser.parse(ExpressionParser.scala:55)
      at org.nlogo.compiler.CompilerMain$$anonfun$compile$1.apply(CompilerMain.scala:34)
      at org.nlogo.compiler.CompilerMain$$anonfun$compile$1.apply(CompilerMain.scala:29)
      at scala.collection.Iterator$class.foreach(Iterator.scala:772)
      at scala.collection.JavaConversions$JIteratorWrapper.foreach(JavaConversions.scala:573)
      at scala.collection.IterableLike$class.foreach(IterableLike.scala:73)
      at scala.collection.JavaConversions$JCollectionWrapper.foreach(JavaConversions.scala:592)
      at org.nlogo.compiler.CompilerMain$.compile(CompilerMain.scala:29)
      at org.nlogo.compiler.Compiler$.compileMoreCode(Compiler.scala:34)
      at org.nlogo.workspace.Evaluator.org$nlogo$workspace$Evaluator$$invokeCompiler(Evaluator.scala:175)
      at org.nlogo.workspace.Evaluator.evaluateCommands(Evaluator.scala:18)
      at org.nlogo.workspace.AbstractWorkspaceTraits$Evaluating$class.evaluateCommands(AbstractWorkspaceScala.scala:163)
      at org.nlogo.workspace.AbstractWorkspaceScala.evaluateCommands(AbstractWorkspaceScala.scala:19)
      at org.nlogo.lite.AppletPanel.command(AppletPanel.scala:137)
      at TestNetLogo.main(TestNetLogo.java:15)
  </code></pre>
  
  <p>Somebody here with an idea?</p>