I want to develop a simple java application which will take the java code input in a text area and find if there are memory leaks in it or not?
Do i have to make a compiler construction code over it? or it can be done simply?
Can someone guide me up in this?

The Java equivalent of a memory leak is when you accidentally keep a reference to an object that prevents it being garbage collected. You would need to apply some incredibly sophisticated analysis to the entire program to have any chance of finding such an error statically.
For that reason people use monitoring tools like visual vm to look at the heap during or after an actual run to see what objects are holding what memory.
In my opinion what you are describing is not realistic.