Showing posts with label unix. Show all posts
Showing posts with label unix. Show all posts

Tuesday, June 9, 2009

Disk Partition strategy for Ubuntu

A newie-bee to Ubuntu may tend to install it in to a single partion ("/"). But it is always advisable to create few more partitions in order make our lives easier, when it is required to re-install Ubuntu as well as when you required to retain the user accounts, their configuration and the softwares insatalled.
In order to achive this, it is required to create atleast another home partition ("/home"). According to the interest, a "/opt" partion can be created in order to install softwares.
Say, You have to re-install Ubuntu due to a inevitable reason, then it is only require to format the root ("/") partion only, other partions can be left intact. You required to create the same user accounts to activate the old user accounts.
In this way, it is possible to re-install Ubuntu without wasting much to configure it again.

Saturday, May 23, 2009

Add multiple jars to classpath

In java (in UNIX like platform), it is not enough just to include the directory, in which the jar dependencies of your application reside, to the classpath. It is required to include path of each and every dependant jars to the classpath. If your application only depends on few jars this is not a problem. But, what if your application depends on several jars say 20, it will be an annoying task to add all the paths of jars to the classpath manually.
It is possible to use a simple shell script to accomplish the above mentioned task. The script can be customized to suit your application very easily.


export JAR_HOME=path to directory which includes jars

for f in $JAR_HOME/*.jar

do

JAR_CLASSPATH=$JAR_
CLASSPATH:$f
done

export JAR_CLASSPATH


#the next line will print the JAR_CLASSPATH to the shell.
echo the classpath $JAR_CLASSPATH


java -classpath $JAR_CLASSPATH Name of the programme

Say your jars are in several diferent folders, then you will have to use a for loop per each directory and finally concaternate to a single variable.