Skip to main content

Posts

Showing posts from 2010

java.lang.UnsupportedClassVersionError

How to resolve this “java.lang.UnsupportedClassVersionError” error ? This exception can occur when the source is built targeting a JDK that is not supported by the JDK attempting to run it. For example, if an application is built targeting only JDK 1.5,  and we try to run it using JDK 1.4, the above exception will occur.

Exporting File System for NFS in Linux

In Linux, we can export a directory for NFS clients by editing the /etc/exports file. The /etc/exports file contains an entry for each directory that can be exported to NFS clients. This file is read automatically by the exportfs command during during system start-up through rc.nfs script. It execute the exportfs command and start the nfsd and mountd daemons. If we modify the entries in this file we must run the exportfs command before the changes can take affect. Now let us export “/home/user” directory : Edit /etc/exports file using vi editor and add following entry: /home/user host1.domain1.com(ro, root_squash) This command will make /home/user directory available to host1.domain1.com /home/user *(ro, root_squash) This command will make /home/user directory available to all users on the network. Here : /home/user is the directory we want to export. host.domain.com is the machine which is been allowed to see this directory over the network. “ro” means mounting with read…

How to check if environment variable is set using shell script?

If you are wondering how can we check whether an environment variable is set or not in the system, here are few methods :
1. Manually a. Run “set” command on the shell prompt, it will list out all the variables set in the system : # set b. Run “echo” command on the shell to print the value of the environment variable : # echo $<environment variable>
2. Through Shell Script Let say we intent to check whether environment variable “envVar” is set or not?
a. Method 1 – checking if “envVar” is set to “” (no value) : if [ "$envVar" == "" ] then echo “envVar is not set” else echo “envVar is set” fi
b.Method 2 – checking if “envVar” is non NULL : if [ -n "$envVar" ] then echo “envVar has non NULL value, it is set.” else echo “envVar has NULL value, it is not set.” fi