---
title: "How to setup a Java Facebook Application"
date: 2010-12-07T23:17:15+00:00
author: "poornerd"
tags: ["facebook", "java"]
canonical: https://www.poornerd.com/2010/12/07/how-to-setup-a-java-facebook-application/
source: Raw Markdown twin of the HTML article; content is the original source.
---
First I discovered that there was an open source, Java based, Facebook Application which includes samples of the following:

<div id="_mcePaste">
  <ul>
    <li>
      Activity Feed
    </li>
    <li>
      Like Button
    </li>
    <li>
      Recommendations
    </li>
    <li>
      Comments
    </li>
    <li>
      Facepile
    </li>
    <li>
      Live Stream
    </li>
    <li>
      Graph API
    </li>
    <li>
      OAuth v2
    </li>
  </ul>
</div>

Activity FeedLike ButtonRecommendationsCommentsFacepileLive StreamGraph APIOAuth v2

It is located at: <a href="http://code.google.com/p/facebook-java-webapp" onclick="javascript:pageTracker._trackPageview('/outbound/article/code.google.com');" target="_blank">http://code.google.com/p/facebook-java-webapp</a>

So I followed the instructions, and checked it out with SVN into a local directory:

<pre class="brush: plain; title: ; notranslate" title="">svn checkout http://facebook-java-webapp.googlecode.com/svn/springwebmvc-hibernate/trunk/ facebook-java-webapp-read-only
</pre>

<p class="p1">
  <span style="color: #000000;">Then I edited the property file as described, to point to the local mysql database I setup with a user &#8220;facebook&#8221; and a database &#8220;facebook&#8221;.</span>
</p>

<p class="p2">
  <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px;"> </span>
</p>

<pre class="brush: plain; title: ; notranslate" title="">emacs src/main/resources/facebook.properties
</pre>

<p class="p2">
  <p class="p2">
    Then I followd the instructions for setting up the database:
  </p>
  
  <p class="p1">
    <span class="s2">http://code.google.com/p/facebook-java-webapp/#Create_Database</span>
  </p>
  
  <p class="p1">
    <span class="s2"><span style="color: #000000; -webkit-text-decorations-in-effect: none;"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px;"> </span></span></span>
  </p>
  
  <pre class="brush: plain; title: ; notranslate" title="">
mvn -Pdb clean
</pre>
  
  <p class="p2">
    I then setup the project:
  </p>
  
  <p class="p2">
    <span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px;"> </span>
  </p>
  
  <pre class="brush: plain; title: ; notranslate" title="">
mvn -Phibernate process-resources
</pre>
  
  <p class="p4">
    <p class="p4">
      And finally ran it:
    </p>
    
    <p class="p4">
      <span style="font-family: Arial;"><span style="font-family: Georgia, 'Times New Roman', 'Bitstream Charter', Times, serif; line-height: 19px;"> </span></span>
    </p>
    
    <pre class="brush: plain; title: ; notranslate" title="">
mvn tomcat:run
</pre>
