This post belongs to Eclipse JDT Tutorial Series.
This error message starts the whole JDT ASTParser tutorial series.
In brief, this is caused by simply adding dependent jar files to regular java project.
To use JDT, you need to have the program running as a plug-in (or at least, an OSGi-enabled application) rather than using it as a jar.
Step by step tutorials can be found by searching button on the right sidebar:
1. How to create a plug-in project?
2. How JDT works?
3. A complete example to parse a java project.
<pre><code> String foo = "bar"; </code></pre>