File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Linux / UNIX and the fly likes environment variable in red hat 4.5.3 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "environment variable in red hat 4.5.3" Watch "environment variable in red hat 4.5.3" New topic
Author

environment variable in red hat 4.5.3

Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

hi all,
i have installed extracted jdk-6u7-linux-i586.bin to /usr directory and created a link by the name java. so the path to java is /usr/java now when i try to set the environment variable for it in /etc/profile by adding this code
JAVA_HOME="/usr/java"
export JAVA_HOME
it gives me this error:
: command not found
: command not found
'bash: /etc/profile: line 6: syntax error near unexpected token `{
'bash: /etc/profile: line 6: `pathmunge () {

help me as its urgent.
how do i set the environment variable for it..
thank you


[Vipassana] - It is seeing the reality as it is, And not as you want it to be.!!!
SCJP1.5.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14435
    
  23

It looks like you've messed up your .profile. Can you show us the complete contents of your .profile?


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

here is the entire file i have just added the JAVA_HOME.
# /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

unset pathmunge

# 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

JAVA_HOME="/usr/java"
export JAVA_HOME
Pravin Shirke
Ranch Hand

Joined: Apr 05, 2008
Posts: 150

any body kindly suggest please
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16308
    
  22

Red Hat version 4 is so old that the only reason anyone should be using it is if they have a 486 machine.

If you mean Red Hat Enterprise 4, I recommend installing the RPM.

You main problem, however, is that Sun designed it so that multiple versions of Java can live on the same machine. So if I wanted to run a Java 5 JVM, I'd set JAVA_HOME to something like /usr/java/jdk1.5.0_06 to select that version.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: environment variable in red hat 4.5.3