Saturday, September 13, 2008

Javaize your Ubuntu

  • Installing Java

    1. Type
      sudo apt-get install sun-java6-bin sun-java6-jre sun-java6-jdk
      .

    2. Read and accept lisece of Sun.

    3. Now we should tell Ubuntu to regard the installed JVM as the default one:

      1. You need to edit a file called /etc/jvm. This file defines the default system JVM search order.

      2. The default system JVM is the first one available from top to bottom.

      3. Type
        $ gksudo gedit /etc/jvm
        so as to open it as root.

      4. The file contains:
        /usr/lib/jvm/java-gcj
        /usr/lib/jvm/ia32-java-1.5.0-sun
        /usr/lib/jvm/java-1.5.0-sun
        /usr

      5. Add
        /usr/lib/jvm/java-6-sun
        such that the file's contents become:
        /usr/lib/jvm/java-6-sun
        /usr/lib/jvm/java-gcj
        /usr/lib/jvm/ia32-java-1.5.0-sun
        /usr/lib/jvm/java-1.5.0-sun
        /usr

      6. Save and close the file.

  • Testing Java

  1. Type
    java -version
    output should be something like:
    java version "1.6.0_06"
    Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
    Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

  2. Create a HelloWorld.java and save it in [certain_directory]

  3. Type
    javac [certain_directory/HelloWorld.java]

    • Nothing should be output.
    • In the the file "HelloWorld.class" must be generated.
    • Move the HelloWorld.class to [another_or_same_dir]

  4. Type
    java -classpath [another_or_same_dir] HelloWorld
  5. Note that that we have set the environmental variable: classpath to avoid the ClassNotFoudException
  6. The HelloWorld.class must be executed (run) and
    Hello World
    is to be printed.

  • Next step .. Eclipse

  • We have two options:

    VersionOption 1Option 2
    Eclipse versionInstalling Eclipse Callisto (3.2)Installing Eclipse Ganymede (3.4)
    AdvantageEnjoying the benefits of eclipse as a universe Ubuntu software package Making use of eclipse latest version and its new features.
    Procedures
    1. System -> Adminstration -> Synaptic Package Manager and enter Password
    2. Highlight the list-item "All" in the left list.
    3. Search for "eclipse".
    4. After it is found -> right click -> mark -> agree -> apply.
    5. Wait till finishing download and installation.
      1. Download eclipse for linux
      2. Copy paste the downloaded .gz file to your home folder
      3. Right click it -> Extract here
      4. Open the extracted folder (eclipse) and here is present the executable eclipse ganymede
      5. Note that the link I provided was to classic eclipse if you want to use the enterprise one or any other version check this

    6. Next step .. The standard widget toolkit (SWT)

    7. Remember that -after migration to Ubuntu- you need to find a replacement to any platform dependent component like JDk, JRE, Eclipse and SWT (which is not the case of either any of nebula widgets as they are based upon SWT, nor Swing GUI library as it is based on JDK and JRE nor Java ribbon which based upon SWT).
      I mean that all of those components will work fine on Ubuntu as well as any OS as long as the proper version of Java (JRE, JDK, JVM, SWT) is installed on the entire OS.
      1. From SWT home download SWT for linux
      2. Keep the downloaded zipped file in a known safe directory.
      3. Unzip it and copy the SWT.jar from it and paste in the directory of ur java project
      4. Refresh the project from eclipse and enjoy..

      Thursday, September 4, 2008

      Compiz, what, why and how

      Understanding Linux, Ubuntu, Compiz
      We all know that Linux is an OSS (Open Source Software) OS (Operating System) but a user friendly OS is a huge product to be free ..
      OS = Kernel + System software

      The first component of Linux (Kernel) was finished in 1991 by Linus Trovalds the student of Helsinki University in Finland. While the second one (System software) were developed, maintained and re-distributed by GNU which is a glorious and a pioneer foundation in the field of the OSS.

      After this "histo-technical" introduction lets mention some -system software programs- definitions.


      Desktop environment


      a style of graphical user interface (GUI) that is used to be the interactive and friendly interface to the user, instead of the old command line interface (CLI).


      Window manager


      The program that is responsible for drawing (rendering) windows, control their appearance and determine how they are displayed and interact with each other.



      Now back to our Ubuntu Hardy ..
      The default Desktop environment is "Gnome", wheres the default window manager is "Metacity".
      I'm ready now to say what Compiz is:
      It is an alternate for Metacity which uses 3D H/W (VGA) to create fast, efficient and advanced visual desktop effects. Here are some photos:








      Now lets move to the "How" section of the post;

      How to obtain Compiz Fusion (which is Compiz with some plug-ins):

      1. First of all ensure that your VGA is not blacklisted from here .
      2. Follow this tutorial
      3. If it is still not working type
        mkdir -p ~/.config/compiz/ && echo SKIP_CHECKS=yes >> ~/.config/compiz/compiz-manager
        to skip checks that compiz performs.
      4. If it is still not working enable the compsite extension in /etc/X11/xorg.conf



      Reboot and enjoy..

      Even after installing compiz you can alternate your Window manager between compiz and metacity by the commands
      compiz --replace &
      and
      metacity --replace &

      I prefer creating a couple of launchers in my panel instead of writing commands each time.

      But why alternating between them?

      Because applications which rely on VGA and performs heavy rendering conflicts with compiz and cause the monitor to continually blink, like Google Earth and any "medium/big" game.