Writing Facebook Applications Using Java EE, Page 3
Figure 6: The "New Project" dialog box, with "Dynamic Web Project" selected
At the New Dynamic Web Project dialog box, fill in the project name as "myfacebookapp" and select your Java EE app server in the "Target Runtime" selection drop down, and "Dynamic Web Project with XDoclet" in the "Configurations" selection drop down. Then, click Finish.
Figure 7: The "New Dynamic Web Project" dialog box
Once you click Finish, Eclipse creates your Dynamic Web Project, and may ask whether you want to switch to the "J2EE Perspective." Once the project is created, you can see the myfacebookapp project in the "Project Explorer." Expand all of its folders to see the structure of your project.
Figure 8: The myfacebookapp project in the Project Explorer
Getting the Facebook Libraries
As mentioned at the beginning of this article, a group of independent Java developers have produced an unofficial but excellent set of Facebook libraries for Java development. Go to http://code.google.com/p/facebook-java-api/ to learn more about the project. These libraries need at least Java SE 5. They will not work with Java SE 1.4 or earlier.
You need to download the following JARs:
If you're running your Java app server on top of Java SE 5, download the following JARs as well:
You don't need the three JARs above if you're running on Java SE 6 or later.
Download the libraries and copy them to the myfacebookapp/WebContent/WEB-INF/lib folder on your disk. Once you copy the libraries to the folder, right-click the myfacebookapp project icon in the Eclipse Project Explorer and select "Refresh." Expand the "Web App Libraries" folder and Eclipse will show you the Facebook library jar files.