Thursday, March 10, 2011

Misc on Ubuntu

Completely remove apache

sudo apt-get remove --purge apache2 apache2-common apache2-mpm-prefork apache2-utils ssl-cert

sudo apt-get autoremove mysql-server

sudo apt-get install mysql-server

sudo apt-get install apache2

sudo apt-get install php5
sudo apt-get install libapache2-mod-php5

sudo apt-get install phpmyadmin

Wednesday, March 9, 2011

My First Ant Project

Create Java Project on Eclipse.

Add build.xml file.







<project name="FirstAntProject"
default="jar" basedir=".">



<property name="dir.src" value="src"/>


<property name="dir.build" value="build"/>

<property name="dir.dest" value="dest"/>




<target name="clean" description="Removing the all
generated files.">

<delete dir="${dir.build}"/>

<delete dir="${dir.dest}"/>


</target>



<target name="prepare" depends="clean">

<mkdir dir="${dir.build}"/>


<mkdir dir="${dir.dest}"/>

<mkdir dir="${dir.src}"/>

</target>



<target name="compile" depends="prepare"

description="Compilation of all source code.">

<javac srcdir="${dir.src}" destdir="${dir.build}"/>

</target>




<target name="jar" depends="compile" description="Generates
helloeddy.jar file in to the 'dest' directory.">

<jar jarfile="${dir.dest}/helloeddy.jar"
basedir="${dir.build}"/>


</target>



</project>





Add helloeddy class.

public class helloeddy {

public static void main(String args[]){

System.out.println("Hello Erdenebat Tsenddorj");
}
}

Result:

Buildfile: /home/erdenebatt/workspace/FirstAntProject/build.xml
clean:
[delete] Deleting directory /home/erdenebatt/workspace/FirstAntProject/build
[delete] Deleting directory /home/erdenebatt/workspace/FirstAntProject/dest
prepare:
[mkdir] Created dir: /home/erdenebatt/workspace/FirstAntProject/build
[mkdir] Created dir: /home/erdenebatt/workspace/FirstAntProject/dest
compile:
[javac] Compiling 1 source file to /home/erdenebatt/workspace/FirstAntProject/build
jar:
[jar] Building jar: /home/erdenebatt/workspace/FirstAntProject/dest/helloeddy.jar
BUILD SUCCESSFUL
Total time: 1 second

Configure Apache Ant & JBoss on Ubuntu 10.10

sudo apt-get install ant

Download JBoss and unzip.

~$ mv jboss-4.2.3.GA /home/erdenebatt/Apps/jboss

~$ sudo cp /home/erdenebatt/Apps/jboss/bin/jboss_init_redhat.sh /home/erdenebatt/Apps/jboss/bin/jboss_init_ubuntu.sh

~$ sudo gedit /home/erdenebatt/Apps/jboss/bin/jboss_init_ubuntu.sh

#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/home/erdenebatt/Apps/jboss"}

#define the user under which jboss will run, or use 'RUNASIS' to run as the current user
JBOSS_USER=${JBOSS_USER:-"erdenebatt"}

#make sure java is in your path
JAVAPTH=${JAVAPTH:-"/usr/bin"}

#configuration to use, usually one of 'minimal', 'default', 'all'
JBOSS_CONF=${JBOSS_CONF:-"default"}

#if JBOSS_HOST specified, use -b to bind jboss services to that address
JBOSS_BIND_ADDR=${JBOSS_HOST:+"-b 0.0.0.0"}

WARNING: Use JBoss 5.1.0.GA's jboss_init_redhat.sh file !!!

~$ sudo cp /home/erdenebatt/Apps/jboss/bin/jboss_init_ubuntu.sh /etc/init.d/jboss

~$ sudo /etc/init.d/jboss start


~$ sudo update-rc.d jboss defaults
-$ sudo update-rc.d -f jboss remove