Every Flavour Beans

“The time has come…to talk of many [technologies].” –Lewis Carroll(’The Walrus and the Carpenter’)
Development Tools. Web Frameworks. GNU/Linux. Nokia N800. Video Encoding.

March 11, 2009

Installing Sun Java SE 6, Apache Maven 2 and Tomcat 5.5 on Ubuntu GNU/Linux

Filed under: General — tabrez @ 4:00 pm

Installing Sun Java SE 6, Apache Maven 2 and Tomcat 5 on Ubuntu GNU/Linux

First go to System -> Administration -> Software Sources and make sure that the multiverse and universe Ubuntu repositories are enabled on your system.

Installing Java SE 6, Apache Maven 2 and Apache Tomcat 5.5 software is just one simple command on Ubuntu family of GNU/Linux operating systems:

# sudo aptitude install sun-java6-jdk tomcat5.5 jetty maven2

I recommend setting JAVA_HOME environment variable to point to the JDK installation directory in your profile file(e.g. .bash_profile or /etc/profile):

export JAVA_HOME /usr/lib/jvm/java-6-sun

The above command also installs the jetty web server which is especially good for development purposes.


If you want to receive future posts by email, enter your email address here:

Related Posts:

  • Installing Sun Java SE 6, Maven 2 and Tomcat 5.5 on Fedora GNU/Linux
  • “Hello, World” Java Web Application using Java SE 6 + Tomcat 5.5 + Maven 2
  • Installing Sun Java SE 6, Apache Maven 2 and Tomcat 5.5 on Windows OS
  • Java on Gentoo
  • Installing Grails in Ubuntu GNU/Linux Using Package Manager
  • Setting Up Development Environment For Grails on GNU/Linux
  • “Hello, World” Web Application using Struts 2 in IntelliJ IDEA 8.0 M1

  • Readers who viewed this page, also viewed:


    January 20, 2009

    “Hello, World” Java Web Application using Java SE 6 + Tomcat 5.5 + Maven 2

    Filed under: General — tabrez @ 9:04 pm

    See my previous posts to install Sun Java SE 6, Apache Tomcat 5.5/6, Apache Maven 2 on Windows and Ubuntu GNU/Linux operating systems:

    Once all the required software components are installed, simply run the following command in the command prompt/shell to generate a basic Java web application project in the current working directory.

    # mvn archetype:create

    You can also run ‘mvn archetype:generate’ if you want to generate the project in interactive mode. The command will then prompt you for relevant information when creating the project.

    # mvn archetype:generate
    [INFO] Scanning for projects…
    [INFO] Searching repository for plugin with prefix: ‘archetype’.
    [INFO] org.apache.maven.plugins: checking for updates from central
    [more output]

    After all the necessary files are downloaded, you will be shown a list of supported archetypes and will be prompted to select the one that you want to generate.

    [INFO] Generating project in Interactive mode
    [INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
    Choose archetype:
    1: internal -> appfuse-basic-jsf (AppFuse archetype for creating a web application with Hibernate, Spring and JSF)
    2: internal -> appfuse-basic-spring (AppFuse archetype for creating a web application with Hibernate, Spring and Spring MVC)
    3: internal -> appfuse-basic-struts (AppFuse archetype for creating a web application with Hibernate, Spring and Struts 2)
    [more options]
    42: internal -> cocoon-22-archetype-block-plain ([http://cocoon.apache.org/2.2/maven-plugins/])
    43: internal -> cocoon-22-archetype-block ([http://cocoon.apache.org/2.2/maven-plugins/])
    44: internal -> cocoon-22-archetype-webapp ([http://cocoon.apache.org/2.2/maven-plugins/])
    Choose a number: (1/2/3/4/5/6/7/8/9/10/11/12/13/14/15/16/17/18/19/20/21/22/23/24/25/26/27/28/29/30/31/32/33/34/35/36/37/38/39/40/41/42/43/44) 15: :

    Enter the appropriate number to select the archetype that you want to generate; for example, enter 18 to create a basic Java Web Application project. Next you will be prompted to enter values for groupId(say ‘hello’), artifactId(say ‘HelloWorld’), version(you can accept the default and just press the ENTER key) and package(say ‘war’). You will then be asked for confirmation; type Y and press the ENTER key. For more information on what the above fields mean, read about Maven Co-ordinates.

    To learn more about Maven’s archetype plugin, read Maven 2 Archetype plugin usage page.

    You can run the basic Java web application project created above in Tomcat web server by running the following command.

    # mvn tomcat:run
    [lot of output]
    [INFO] Starting tomcat server
    [INFO] Starting Servlet Engine: Apache Tomcat/5.5.15
    [INFO] XML validation disabled
    [INFO] Initializing Coyote HTTP/1.1 on http-8080
    [INFO] Starting Coyote HTTP/1.1 on http-8080

    (If this is the first time you are running the above command, it downloads a lot of necessary files and stores them in the local Maven repository. This is a one-time operation.) You can now access the web application from a location like “http://localhost:8080/HelloWorld/”. ‘HelloWorld’ is the artifactId that we used when creating the sample application. You can read more about running and deploying applications from Maven to Tomcat web server on Maven Tomcat plugin page.

    If Jetty web server is installed on your computer, you can also run your web application in Jetty by running the following command:

    # mvn jetty:run

    How easy it is to switch the container when you are developing Java web applications with the Maven build tool! You can read more about running and deploying applications from Maven to Jetty web server on Maven 2 Jetty Plugin page.


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • Installing Sun Java SE 6, Apache Maven 2 and Tomcat 5.5 on Ubuntu GNU/Linux
  • Installing Sun Java SE 6, Maven 2 and Tomcat 5.5 on Fedora GNU/Linux
  • Installing Sun Java SE 6, Apache Maven 2 and Tomcat 5.5 on Windows OS
  • “Hello, World” Web Application using Struts 2 in IntelliJ IDEA 8.0 M1
  • Java on Gentoo
  • Is C++ really a bigger language than Java?
  • “Hello, World” Web Application using Struts 2 in NetBeans IDE 6.1

  • Readers who viewed this page, also viewed:


    December 17, 2008

    Setting Up Rails Development Environment on Fedora GNU/Linux

    Filed under: General — tabrez @ 10:52 pm

    This is an adaptation to Fedora GNU/Linux platform of my previous posts meant for the Windows & Ubuntu platforms: Setting Up Rails Development Environment on Windows Vista/XP and Setting Up Rails Development Environment on Ubuntu GNU/Linux.

    I can think of two different ways in which you might want to set up a development environment for Ruby on Rails on a GNU/Linux machine. One is to download everything outside of the package manager of your distribution i.e. build everything from the source. I am going to cover the second, easier way: how to setup Rails on a Fedora machine using its package manager for the most part. I show below how to setup Ruby, RubyGems, Rails, Mongrel, MySQL, and Git as part of the development stack.

    1. Installing Ruby:

      Install the Ruby and related packages as root user:

      # yum install ruby ruby-docs ruby-irb ruby-ri ruby-sqlite3
    2. Installing Rubygems

      Though it is possible to install Rubygems using the Fedora package manager, not only will you get an old version of rubygems if you do so, it also may not be compatible with the latest version of rails. I strongly recommend you download the source code package of the latest version of rubygems and install it using its setup script:

      # cd $HOME
      # wget http://rubyforge.org/frs/download.php/45906/rubygems-1.3.1.zip
      # tar xvzf rubygems-1.3.1.tgz && cd rubygems-1.3.1
      # ruby setup.rb

      Remember to download the latest version of rubygems available(currently 1.3.1). You can remove the downloaded tgz archive and the extracted directory after the installation is finished.

      #cd $HOME
      # rm -r rubygems-1.3.1.tgz rubygems-1.3.1
    3. Installing Rails

      Update all the gems(not really needed) and then install the rails gem.

      # gem update –&ndashsystem
      # gem install rails

      To update rails in future, run ‘gem update rails’ command.

      Check the versions to confirm installation:

      # ruby -v
      ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-linux]
      # gem -v
      1.3.1
      # rails -v
      Rails 2.2.2
    4. The basic Rails development environment is now installed on your system and you can skip the rest of the post if you are happy with WEBrick as the web server, SQLite as the database server and your favourite text editor/IDE that may be already installed on your system. The following instructions cover installing an alternate web server called Mongrel and MySQL database server and its GUI tools.

    5. Installing Mongrel

      Installing the Rails gem also installs the WEBrick web server which is ideally suited for development purposes. Another much recommended web server for Rails development as well as production environment is the Mongrel web server. To install the Mongrel web server, run the following gem command:

      # yum install mongrel

      After installing Mongrel, Rails automatically starts Mongrel instead of WEBrick web server when you run Rails applications in development mode. (Refer to Mongrel documentation to know more about running Rails applications under Mongrel in production mode.)

    6. Installing MySQL

      This step covers the installation of MySQL database server and its GUI tools. Skip this step if you want to use some other database server. Run the following command to install the required mysql packages:

      # yum install mysql-server mysql-administrator mysql-gui-tools

      One important step during the configuration process is to select a root password(you will need to enter it in the database.yml configuration file of your Rails application).

    7. Source Control

      To setup your rails application using git source code management tool, see my other post:
      Setting Up Ruby on Rails Projects with Git and Github

      You can also install cvs or subversion or other version control software using yum package manager.

      # yum install cvs subversion

    Now you can create/checkout Rails applications, edit the files using your favourite text editor/IDE and run it under Mongrel. In future, I will try to write about developing Rails applications using integrated development environments like Eclipse and NetBeans.


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • “Hello, World” Web Application in Ruby on Rails using console
  • Setting Up Rails Development Environment on Ubuntu GNU/Linux
  • Setting Up Rails Development Environment using Aptana Studio
  • “Hello, World” Web Application in Ruby on Rails using Aptana Studio
  • Setting Up Ruby on Rails Projects with Git and Github
  • Installing C++ Boost on SuSE and Fedora
  • Setting Up Development Environment For Grails on GNU/Linux

  • Readers who viewed this page, also viewed:


    December 9, 2008

    Setting Up Ruby on Rails Projects with Git and Github

    Filed under: General — tabrez @ 4:15 pm

    Git is the favourite source code management tool of the Ruby on Rails community these days. Though GNU/Linux or Mac platforms are generally preferred to Windows by Ruby on Rails as well as git communities, I will show you how you can work with these technologies on Windows platform. I will also show how to host a git public/share repository of a Rails application on the Github free web service. Note that the following information applies to any project, not just Rails.

    1. Refer to my earlier post to see how to install Ruby on Rails on the Windows platform. You can skip some of the later parts if you wish.

      Setting Up Rails Development Environment on Windows Vista/XP

    2. Git still has some issues on the Windows platform but for normal usage the msysgit package shouldn’t let you down. Download and install it from its Google Code page.

      Download msysgit for Windows

      Read the information in last few dialog boxes carefully during the installation and select the settings you prefer. The following screenshots show the settings I have picked when installing msysgit on my system.

      Install a separate git shell in which to run the git commands:

      Git's independent command shell

      I can go to any git initialized directory, right-click a file and say “Git Bash Here” which will save me a lot of ‘cd’ commands:

      Start Git shell from any Windows directory

      Git’s built-in SSH support is more than enough for development purposes:

      Git's built-in SSH support

      Now you can just go to any Rails directory and run ‘git init’ there to track the files under git.

      Start Git Bash shell from the Start Menu.

      Go to your Rails directory and run the following commands.

      Example session:

      # cd hello
      # ls
      # git init
      # git add .

      For more git commands that you can use, refer to Git Tutorial. To learn more about how Git handles line ending conversions(especially important to Windows users), refer to gitattributes man page.

    3. If you are working alone on a particular application or you are just interested in maintaining the history of the source code changes locally, then you might prefer just working with in the project directory. If I want to share the changes with friends/colleagues or the world at large, we need a public git repository. Github and Assembla are but only two examples that have good free packages to get started with.

      Create a new account on Github.

      • Go to github.com
      • Click the link “Pricing and Signup” at the top of the page.
      • Pick a package(say “Open source” which is free) and click “Signup” button.
      • Fill in the information and click “I agree, sign me up!” button if you agree to all the policies.

      You need to enter your public SSH key when creating a Github account. If you don’t already have SSH keys generated, you can generate one using git tools. Github website has nice explanation on how to go about setting up SSH key on Windows for Github, so just follow the procedure.

      Once you have created the account and are logged in, click the “Create new one” link on the dashboard page, fill in the details and click the “Create Repository” button to create an empty repository on Github.

      Now you can push the contents of your Rails directory to the empty git repository that we created on Github in the previous step by running the following command in Git Bash shell:

      # cd hello
      # git remote add origin git@github.com:tabrez/hello.git
      # git push origin master

      Adjust the second command according to your account/project details. Now you can say ‘git push’ from your git tracked directory anytime you want to publish your changes to Github, so that others can pull these changes to their computers and merge them with their local git repository.

      Read more about git push.
      Read more about Github.

    I will try to write about more tools that help in being more productive with development with Rails in future articles.


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • Setting Up Rails Development Environment on Fedora GNU/Linux
  • Setting Up Rails Development Environment using Aptana Studio
  • “Hello, World” Web Application in Ruby on Rails using console
  • Setting Up Rails Development Environment on Ubuntu GNU/Linux
  • “Hello, World” Web Application in Ruby on Rails using Aptana Studio
  • Setting Up Rails Development Environment on Windows Vista/XP
  • Setting Up Development Environment For Grails on Windows Vista/XP

  • Readers who viewed this page, also viewed:


    August 19, 2008

    How Wordpress 2.6 ‘Post Revisions’ Retrieved My Unsaved Post Updates

    Filed under: General, Wordpress — tabrez @ 3:24 pm

    The feature announced to be included in the next version of Wordpress that had excited me the most was the Post Revisioning feature that was set for the Wordpress 2.6 release. After having used 2.6 version for so many days, I finally had a taste of its usefulness today. (Even though I didn’t get to use it much until now, the peace of mind that you get to carry while editing the posts makes the feature worth every effort put in by the Wordpress development team).

    I did nothing strange on this occasion: while editing and saving and editing and saving and… a draft post, I opened another related, older post in a new browser tab and made a few changes to that post too. Just forgot to save it! I don’t remember when I had closed that tab as my focus was on my current draft post. When I opened the older post again after sometime, Wordpress displayed a notice informing me that there is a newer auto-saved version of the post available:

    Wordpress 2.6 warns about autosaved version of a post and allows restoring it through its new Post Revisions feature.

    Auto-saving posts/drafts is old news. But near the bottom of the page, I could see the complete history of my edits, the relevant date and time information included:

    Wordpress 2.6 warns about autosaved version of a post and allows restoring it through its new Post Revisions feature.

    Clicking on “View the autosave” link(see the first screenshot above) took me to the automatically saved version of the page. Scrolling down the page took me to “Post Revisions” section where I could select the versions that I want to compare:

    Wordpress 2.6 warns about autosaved version of a post and allows restoring it through its new Post Revisions feature.

    And finally, I was able to view the two versions side-by-side to see the difference between the two versions visually(click the image to see the larger version):

    Wordpress 2.6 warns about autosaved version of a post and allows restoring it through its new Post Revisions feature.

    (Bonus: What happens if you compare the same versions of a post? Wordpress 2.6 Easteregg!)

    A click of a button switched the post to the autosave version(because that’s what I had wanted):

    Wordpress 2.6 warns about autosaved version of a post and allows restoring it through its new Post Revisions feature.

    And the post was restored:

    Wordpress 2.6 warns about autosaved version of a post and allows restoring it through its new Post Revisions feature.

    (I didn’t have to worry a lot when restoring because I can always go back to the earlier version because all the revisions are still there.)

    Nothing that I didn’t know already but actually going through the process and being able to save those few edits that would have been lost into thin air(or difficult to restore) in earlier versions of Wordpress was quite a bit of fun. The whole experience was seamless and tension-free.

    Just sharing the excitement ;)


    If you want to receive future posts by email, enter your email address here:

    Related Posts:

  • My First Wordpress 2.3 Update Notification and Subversion Upgrade
  • Wordpress Upgrading Experience With Automatic Upgrade Plugin
  • Upgrading to Wordpress 2.3 with Zero Downtime!
  • What is New in Wordpress 2.3 (Beta 1/2)?
  • Why I Moved My Blog From Wordpress.com
  • Wordpress Plugin and Theme Cheatsheets
  • How I Upgraded to Wordpress 2.3 on Live Blog With Zero Downtime

  • Readers who viewed this page, also viewed:


    Next Page »

    Copyright (c) 2006, 2007 Tabrez Iqbal.
    Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. Verbatim copying and distribution of this entire article is permitted in any medium without royalty provided this notice is preserved. A copy of the license is included in the section entitled "GNU Free Documentation License".


    Powered by WordPress
    This website is hosted by Dreamhost