DOWNLOADING
Download the latest version of JDK from http://www.java.sun.com. I have downloaded jdk-1_5_0_05-linux-i586-rpm.bin
PROCESS OF JDK CONFIGURATION
1. Install jdk by using following command
[root@localhost ~]#chmod a+x jdk-1_5_0_05-linux-i586-rpm.bin
[root@localhost ~]#rpm ./jdk-1_5_0_05-linux-i586.bin
Note: that the initial "./" is required if you do not have "." in your PATH environment variable.
This command creates a directory called jdk1.5.0_05 in your home directory.
2. Path setting process
Go in /etc directory n open file named profile by this command
root@localhost ~]#cat /etc/profile
# /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
3. Change configuration file by following command.
root@localhost ~]#vi /etc/profile
# /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
pathmunge () {
if ! echo $PATH | /bin/egrep -q "(^|:)$1($|:)" ; then
if [ "$2" = "after" ] ; then
PATH=$PATH:$1
else
PATH=$1:$PATH
fi
fi
}
# Path manipulation
if [ `id -u` = 0 ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
fi
pathmunge /usr/X11R6/bin after
# No core files by default
ulimit -S -c 0 > /dev/null 2>&1
USER="`id -un`"
LOGNAME=$USER
MAIL="/var/spool/mail/$USER"
HOSTNAME=`/bin/hostname`
HISTSIZE=1000
if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
INPUTRC=/etc/inputrc
fi
JAVA_HOME="/usr/java/jdk1.5.0_05"
export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE INPUTRC
for i in /etc/profile.d/*.sh ; do
if [ -r "$i" ]; then
. $i
fi
done
unset i
unset pathmunge
4. Run JDk by following command.
root@localhost ~]# javac
5. Make a java program by following command
root@localhost ~]#
vi HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World!");
}
}
6. Compiling steps
[root@localhost ~]#javac
HelloWorld.java
[root@localhost ~]#
java HelloWorld
Hello World
No comments:
Post a Comment