I'm using Eclipse ast/jdt as is explained in this post - How can I use the java Eclipse Abstract Syntax Tree in a project outside Eclipse? (ie not an eclipse plugin)
The problem is that I always get null when I tried to use resolveBinding(), and it's because of not using setProject(IJavaProject) or setEnvironment(String[], String[], String[], boolean), as is written in this post - VariableDeclarationFragment node resolveBindind() returns null in eclipse/jdt/ast
Solving the returning null issue, I tried to use the code but ended up getting an error saying Workspace is closed.
What might be wrong?

I have .project file in the my workspace
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>AstRewrite4</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>