Tuesday, August 31, 2010

Getting Java, JRuby Setup on linux

Now that we have our Virtual Machine it's time to get Java, Eclipse, JRuby, and App-Engine set up.

  1. Install Java

    Open the synaptic package manager, enter your admin password at the prompt.



    In the Quick search box type "java jdk", and then select the latest openjdk version (I've chosen 6).
    Right click, and click "Mark for Installation".
    Click apply.



    You can test if java is installed by opening a terminal (Applications -> Accessories -> Terminal), and typing "java", and "javac". If you do not get a "command not recognised" type of response, then it's been successfully installed.

  2. First of all you're going to need to install Ruby. We've already installed something via the synaptic package manager, now let's try the same thing via terminal:

    Type in a terminal (run a command then run the next):


    sudo apt-get install ruby
    sudo apt-get install rubygems
    sudo gem install google-appengine
Note: At the time of writing this (September 2010, I had to install the 1.8 version of rubygems, as the 1.9.x version didn't work properly (gave loads of errors when following the tutorial).

Type the following into the terminal:
appcfg.rb

If that command didn't show you a whole heap of options, then you're going to need to update your path variable to tell the system where the appcfg.rb file is:

Open the Terminal (Applications -> Accessories -> Terminal)

Type the following command to open the .bashrc file in the gedit text editor:
gedit ~/.bashrc
Add the following lines at the bottom of the file (using the path to the jruby bin folder, instead of "/new_path" - mine was /var/lib/gems/1.8/bin - it might also be in your home folder in a hidden ".gem" folder. you can always issue command "gem environment" to see where gems are installed to):
PATH=$PATH:/new_path
export PATH
Then, either log out and back it or type the following command in a terminal:
source ~/.bashrc

Follow the rest of the tutorial at http://code.google.com/p/appengine-jruby/wiki/CreateApp to create a working hello world app on AppEngine! (your webpage should say "hello" if you are successful)

No comments:

Post a Comment