Monday, November 8, 2010

Java Development with Ubuntu 10.10

This is first step of migration for the software engineers from window platform to linux platform. I am Java Developer and doing my java development in windows platform.  


Here is my window development configurations:

  • OS - windows 7
  • Java version - JDK 6
  • IDE - Netbeans 6.91
  • Application Server - Tomcat 7
  • Database Server - MySQL
  • Version Control - tortoisesvn
Ok. Lets assume you have successfully installed and setup the Ubuntu 10.10 and can access the internet.

Step 1: Install Java

It is obvious that most of linux dis have installed Open JDK at the os installation time. If you are new for java development go this Open JDK.(I never tested open Jdk with netbeans). But when you run your existing code, you might get errors and the only solution for that is use sun java jdk. 

In this step i am going to show you how to install sun jdk for ubuntu 10.10.

Go to Ubuntu Software Center 
Applications –> Ubuntu Software Center.
Then click Edit –> Software Sources..
Next, select ‘Other Software’ tab 
Then Click 'Add..' button to add the software source and paste bellow text for the APT line: text box  
deb http://archive.canonical.com/ubuntu lucid partner                  
Click Add Source button to close the Software Source window.
It will take few second to update the source index for the newly added source. Then search for the keyword sun-java jdk" and will be listed the results. Select required version and click install. 


Step 2: Install Netbeans

Before installing netbeans, make sure that you have installed sun java. Please follow the step 1 to install the sun java on ubuntu 10.10

Download latest version of netbeans from the http://www.netbeans.org web site and download latest stable version.

Once you have downloaded Open a terminal window and navigate to your Download directory (where you downloaded NetBeans installer script). Once you are at your download directory, type the following command to begin the installation.

sudo sh netbeans-6.9rc2-ml-linux.sh                                    

Above command will initialize the installation process which is very much familiarly to you to just clicking next, agreed and finished. (You have to select your desired application servers..etc).

After successfully installed you can open from Application->Programming->netbeans 6.7

Step 3; Tomcat 7

sudo wget http://apache.hoxt.com/tomcat/tomcat-7/v7.0.4-beta/bin/apache-tomcat-7.0.4.tar.gz

tar xvzf apache-tomcat-7.0.4.tar.gz                                                               

sudo mv apache-tomcat-7.0.4 /usr/local/tomcat                                              
(Move tomcat to the permanent location)

Tomcat requires setting the JAVA_HOME variable. The best way to do this is to set it in your .bashrc file. You could also edit your startup.sh file if you so chose.
The better method is editing your .bashrc file and adding the bolded line there. You’ll have to logout of the shell for the change to take effect.
vi ~/.bashrc                                                                                                 

add following line: 

#java_home settings                                                                                    
export JAVA_HOME=/usr/lib/jvm/java-6-sun                                                  

Save vi editor by typing :wq           

Writing auto startup file:

sudo vi /etc/init.d/tomcat                                                                              

Paste following text in the file:

# Tomcat auto-start
#
# description: Auto-starts tomcat
# processname: tomcat
# pidfile: /var/run/tomcat.pid

export JAVA_HOME=/usr/lib/jvm/java-6-sun
case $1 in
start)
sh /usr/local/tomcat/bin/startup.sh
;;
stop)
sh /usr/local/tomcat/bin/shutdown.sh
;;
restart)
sh /usr/local/tomcat/bin/shutdown.sh
sh /usr/local/tomcat/bin/startup.sh
;;
esac
exit 0

type :wq and exit with saving the file.

sudo chmod 755 /etc/init.d/tomcat                                           
(make the script executable)

Creating the symbolic link:

sudo ln -s /etc/init.d/tomcat /etc/rc1.d/K99tomcat                    
sudo ln -s /etc/init.d/tomcat /etc/rc2.d/S99tomcat                    

Thats all. Open your browser and check the URL 'http://locahost:8080/' and you will see tomcat welcome page.


Step 4: MySQL Server

This is again an easy task by opening Ubuntu Software Center and search for the Mysql Server. 

Step 5: Version Control

Since tortisSVN is not available for linux upto date we need to have a alternatives. I have selected RabitVCS instead. (Hope rabit is faster than tortis)

Here is the command to install RabitVCS.

sudo apt-get install rabbitvcs-nautilus rabbitvcs-gedit rabbitvcs-cli              

You need to open nautilus explorer to use the rabitvcs in action.


Ok..thats all about it. Enjoy the java programing with ubuntu 10.10

Thanks for reading....
 

No comments:

Post a Comment