title: antlr 4.2 difficulty using Parser
body: <p>I just started with antlr, And I am using 4.2. Easy guessing says it would be like antlr3 in basics. so I followed the accepted answer of <a href="https://stackoverflow.com/questions/1931307/antlr-is-there-a-simple-example">this</a> question. (But instead of Exp, I replaced Java, which means I want to parse Java) Everything is fine, Until I want to compile the ANTLRDemo.java example.</p>
  
  <p>When I compile that, I get 4 errors:</p>
  
  <pre><code>    ANTLRStringStream in = new ANTLRStringStream("some random text");
      JavaLexer lexer = new JavaLexer(in);
  </code></pre>
  
  <ul>
  <li><p>first error: constructor JavaLexer in class JavaLexer cannot be applied to
  given types; JavaLexer lexer = new JavaLexer(in);   required:
  CharStream   found: ANTLRStringStream   reason: actual argument
  ANTLRStringStream cannot be converted to CharStream by method
  invocation conversion           (I know what this error is ;-)</p>
  
  <pre><code>CommonTokenStream tokens = new CommonTokenStream( lexer);
  JavaParser parser = new JavaParser(tokens);
  System.out.println(parser.eval());
  </code></pre></li>
  </ul>
  
  <p>to make it short, let's say every line has its own similar error. For example, "parser" does not have an "eval()" method.</p>
  
  <p>What am I missing? I guess antlr4 does not run like 3. Any Ideas? Please consider my beginner status.</p>