huangp@vm:~$

All geeky stuff

ubuntu dev environment (intelliJ and environment variables)

Quick notes to myself and may help others.

  • Download simsun.ttf font and double click to install. Change browser font settings to use this fond. Better Chinese view.
  • Download jdk, maven, intellij and install.
  • Create a text file (I generally name it env_variable) under home directory with following content(adjust accordingly):
    export WORK=$HOME/work
    export TOOLS=$HOME/toolsexport JAVA_HOME=$TOOLS/jdk1.6.0_22
    export JDK_HOME=$JAVA_HOMEexport IDEA_HOME=$TOOLS/idea-IU-107.105
    export SCRIPTS=$HOME/scripts
    export M3_HOME=$TOOLS/apache-maven-3.0.3
    #export M2_HOME=$TOOLS/apache-maven-2.2.1
    #export ROO=$TOOLS/spring-roo-1.1.0.RELEASE
    export GROOVY_HOME=$TOOLS/groovy-1.8.2
    export NEXUS_HOME=$TOOLS/nexus-1.9.1.1
    export ANDROID_SDK_HOME=$TOOLS/android-sdk-linux_x86
    #:$ROO/bin
    PATH=$JAVA_HOME/bin:$M3_HOME/bin:$SCRIPTS:$IDEA_HOME/bin:$GROOVY_HOME/bin:$ANDROID_SDK_HOME/tools:$PATH
    
  • Open file manage (nautilus) and go to home folder, ctrl + h to show hidden files. Then open .profile file and add following line (assuming saving above created file as env_variable)
    # load environment variables
    . $HOME/env_variables
    

    The reason why we source this environment variable file in .profile is, if you want to launche intellij from your desktop GUI(gnome), it requires JDK_HOME being set. If you don’t have .bash_profile defined, both your terminal and gnome will use .profile. This way you can easily create an application launcher in gnome.

  • Right click gnome panel and select Add to Panel…, then select Custome Application Launcher, name as ‘intellj’, command browse to your intellij bin folder and select idea.sh. There are some nice icon under bin folder too for you to choose. After reboot you should be able to launch intellij from here.
  • Change file system watcher handles number. See this for more detail. If you use latest intellij you should already have those fsnotifier files under your intellij bin folder. All you need to do is execute following command in shell
    gksu gedit /etc/sysctl.conf

    add

    fs.inotify.max_user_watches = 524288

    to last line. Execute

    sudo sysctl -p

    to take effect.

  • For ubuntu 10.04 only. If you want your gnome terminal to open up with a better default size, execute
    gksu gedit /usr/share/vte/termcap/xterm

    find lines as

    xterm-xfree86|xterm-new|xterm terminal emulator (XFree86):\
    :am:km:mi:ms:xn:\
    :co#80:it#8:li#24:\

    The co#80 is the column width and li#24 is row number. I normally make column to 132.

Happy coding 🙂

Leave a comment