Sunday, September 30, 2012

Android development using jEdit part 1

While there are many good IDEs for android development like eclipse, NetBeans, intelliJ;  sometimes one may want to use lightweight editor to create android apps and still don't want to get into command line every time.

Here's a little how-to of creating android projects, AVDs using jEdit and it's Android plugin.

First off-course you need Android SDK installed and setup the path. Following is one example on openSUSE 12.2.

Download the Android SDK from this link.
Unzip into a convenient location, remember that you need to give the location name in PATH environment variable.
Install Android version you want to target.

Setup PATH in .profile, for example
export PATH=${PATH}:/home/ashish/android-sdk-linux/tools/
Install jEdit from here (I am using jEdit 5.0pre1)
Open plug-in manager and install Android plugin

Now you will start seeing options for creating AVDs, projects etc.

In upcoming parts I shall describe Android development further using jEdit, and its Android plugin.

Saturday, September 29, 2012

Installing Oracle JDK on Ububtu 12.04 and openSuse 12.2

Ubuntu and openSuse both come with openJDK installed, however at times one needs Oracle JDK to be present in the system. Here are the steps needed to install it on both OS.

1. Download Oracle JDK  fron oracle site Download Oracle JDK. These instrction are for 

Java SE 6 Update 35.

2. Copy it to "/usr/lib/jvm" directory
# cp jdk-6u35-linux-i586.bin /usr/lib/jvm
3. Make it executable and run it
 # chmod +x jdk-6u35-linux-i586.bin
# ./jdk-6u35-linux-i586.bin
It shall unzip itself and create directories.

4. Install it in alternatives system
# sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.6.0_35/bin/java 1 
 # sudo update-alternatives --install /usr/bin/javac javac /usr/lib/jvm/jdk1.6.0_35/bin/javac 1
 # sudo update-alternatives --install /usr/bin/javaws javaws /usr/lib/jvm/jdk1.6.0_35/bin/javaws 1
 Here is what update-alternatives' man page says about installing
update-alternatives  --install <link> <name> <path> <priority>

5. Now select it as default by running these commands and select the JDK
# sudo update-alternatives --config java
# sudo update-alternatives --config javac
# sudo update-alternatives --config javaws 
6. Create plugin link
# sudo ln -s /usr/lib/jvm/jdk1.6.0_35/jre/lib/i386/ /usr/lib/mozilla/plugins
7. Now test it with version
# java  -version
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) Client VM (build 20.10-b01, mixed mode, sharing)

For openSuse all above is same except these enviornment variables needs to be put in "/etc/profile"

export JAVA_HOME=//usr/lib/jvm/jdk1.6.0_35/
export JAVA_BINDIR=//usr/lib/jvm/jdk1.6.0_35/bin/
export JAVA_ROOT=//usr/lib/jvm/jdk1.6.0_35/
export JDK_HOME=//usr/lib/jvm/jdk1.6.0_35/
export JRE_HOME=//usr/lib/jvm/jdk1.6.0_35/

Some software like jEdit use  these variables to detect Java.

Though these instructions are for Ubuntu and openSuse, they might work for other distros.

Hope this helps as I got from other sources.

Thanks for reading.