ASTParser parser = ASTParser.newParser(AST.JLS3);
Properties prop = System.getProperties();
String [] classPathEntries = prop.getProperty("java.class.path").split(":");
String [] sourcePathEntries = new String[]{"/path/to/project/src/dir"};
parser.setEnvironment(classPathEntries, sourcePathEntries, null, true); //does not work with "false" either
parser.setResolveBindings(true);
parser.setSource(source);
parser.setKind(ASTParser.K_STATEMENTS);
Map options = JavaCore.getOptions();
JavaCore.setComplianceOptions(JavaCore.VERSION_1_7, options);
parser.setCompilerOptions(options);
Block block = (Block) parser.createAST(null);
org.eclipse.core.runtime_3.5.0.v20090525.jar
org.eclipse.equinox.common_3.5.1.R35x_v20090807-1100.jar
org.eclipse.core.resources_3.5.2.R35x_v20091203-1235.jar
org.eclipse.core.jobs_3.4.100.v20090429-1800.jar
org.eclipse.osgi.jar
org.eclipse.core.contenttype_3.4.1.R35x_v20090826-0451.jar
org.eclipse.equinox.preferences_3.2.301.R35x_v20091117.jar
org.eclipse.jdt.core_3.7.3.v20120119-1537.jar
]]>