It should be possible. As Tim pointed out, you have to spend time programming it.
May be you can start with
http://developers.facebook.com/docs/ learn the API - They should be mostly
REST based API which you can implement in your
Java based web application.
As there are lot of things you can do with Facebook API- You are trying to authenticate user based on Facebook credentials? or are you trying to create commenting system and lot other things which come with it for your application? Or are you trying to do other things? In any case for you to use Facebook features in your web applications you would have to create a Facebook Application.
But you might be thinking of creating a Facebook application using Java - Then this might be interesting read:
https://developers.facebook.com/docs/guides/canvas/