Ajuda em configurar CLASSPATH em /etc/profile

Fala galera,
tive problemas em configurar este arquivo na ultima tentativa e tive q reinstalar o linux…
tudo reinstalado, e coloquei o java em /var/jdk1.5.0_12

Agora gostaria de configurar o CLASSPATH, PATH, MANPATH e o JAVA_HOME…

segui informações passadas aqui no forum e falaram isso:

[b]#

Adicionar o CLASSPATH o PATH o MANPATH e o JAVA_HOME

CLASSPATH=/var/jdk1.5.0_12/lib
export CLASSPATH
JAVA_HOME=/var/jdk1.5.0_12
export JAVA_HOME
PATH=/var/jdk1.5.0_12/bin
export PATH
MANPATH=/var/jdk1.5.0_12/man
export MANPATH[/b]

Tudo bem… mais isso aonde??? como coloco essas linhas?? em qualquer lugar do meu arquivo /etc/profile???

Segue o meu arquivo:

[code]# /etc/profile for SuSE Linux

PLEASE DO NOT CHANGE /etc/profile. There are chances that your changes

will be lost during system upgrades. Instead use /etc/profile.local for

your local settings, favourite global aliases, VISUAL and EDITOR

variables, etc …

Check which shell is reading this file

if test -f /proc/mounts ; then
case “/bin/ls -l /proc/$$/exe” in
*/bash) is=bash ;;
*/rbash) is=bash ;;
*/ash) is=ash ;;
*/ksh) is=ksh ;;
*/pdksh) is=ksh ;;
*/zsh) is=zsh ;;
/) is=sh ;;
esac
else
is=sh
fi

Initialize terminal

tty=tty 2> /dev/null
test $? -ne 0 && tty=""
if test -O “$tty” -a -n “$PS1”; then
test -z “${TERM}” && { TERM=linux; export TERM; }
test “${TERM}” = “unknown” && { TERM=linux; export TERM; }
# Do not change settings on local line if connected to remote
if test -z “$SSH_TTY” ; then
test -x /bin/stty && /bin/stty sane cr0 pass8 dec
test -x /usr/bin/tset && /usr/bin/tset -I -Q
fi
# on iSeries virtual console, detect screen size and terminal
if test -d /proc/iSeries -a ( “$tty” = “/dev/tty1” -o “$tty” = “/dev/console” ) ; then
LINES=24
COLUMNS=80
export LINES COLUMNS TERM
if test -x /bin/initviocons ; then
eval /bin/initviocons -q -e
fi
fi
fi
unset TERMCAP

Time until a complete key sequence must have arrived

#ESCDELAY=2000
#export ESCDELAY

The user file-creation mask

The global umask value is stored in /etc/login.defs and

will be set by pam_umask.so (see “man pam_umask”).

#umask 022

Setup for gzip and (t)csh users

if test -z “$PROFILEREAD” ; then
# GZIP=-9
# export GZIP
CSHEDIT=emacs
export CSHEDIT
fi

ksh/ash sometimes do not know

test -z “$UID” && readonly UID=id -ur 2> /dev/null
test -z “$EUID” && readonly EUID=id -u 2> /dev/null
test -z “$USER” && USER=id -un 2> /dev/null
test -z “$MAIL” && MAIL=/var/spool/mail/$USER
test -z “$HOST” && HOST=/bin/hostname -s 2> /dev/null
test -z “$CPU” && CPU=/bin/uname -m 2> /dev/null
test -z “$HOSTNAME” && HOSTNAME=/bin/hostname 2> /dev/null
test -z “$LOGNAME” && LOGNAME=$USER
case “$CPU” in
i?86) HOSTTYPE=i386 ;;
*) HOSTTYPE=${CPU} ;;
esac
OSTYPE=linux
MACHTYPE=${CPU}-suse-${OSTYPE}

Do NOT export UID, EUID, USER, and LOGNAME

export MAIL HOST CPU HOSTNAME HOSTTYPE OSTYPE MACHTYPE

You may use /etc/initscript, /etc/profile.local or the

ulimit package instead to set up ulimits and your PATH.

if test “$is” != “ash” -a ! -r /etc/initscript; then

ulimit -Sc 0 # don’t create core files

ulimit -Sd $(ulimit -Hd)

ulimit -Ss $(ulimit -Hs)

ulimit -Sm $(ulimit -Hm)

fi

Make path more comfortable

if test -z “$PROFILEREAD” ; then
PATH=/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin
if test “$HOME” != “/” ; then
for dir in $HOME/bin/$CPU $HOME/bin ; do
test -d $dir && PATH=$dir:$PATH
done
fi
if test “$UID” = 0 ; then
test -d /opt/gnome/sbin && PATH=/opt/gnome/sbin:$PATH
test -d /opt/kde3/sbin && PATH=/opt/kde3/sbin:$PATH
PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH
fi
for dir in /var/lib/dosemu
/usr/games
/opt/bin
/opt/gnome/bin
/opt/kde3/bin
/opt/kde2/bin
/opt/kde/bin
/usr/openwin/bin
/opt/cross/bin
do
test -d $dir && PATH=$PATH:$dir
done
unset dir
export PATH
fi

Many programs using readline library for line editing

should know about this (e.g. bash)

if test -z “$INPUTRC” ; then
INPUTRC=/etc/inputrc
test -s $HOME/.inputrc && INPUTRC=$HOME/.inputrc
export INPUTRC
fi

Most bourn shell clones knows about this

if test -z “$PROFILEREAD” ; then
HISTSIZE=1000
export HISTSIZE
fi

Set some environment variables for TeX/LaTeX

if test -n “$TEXINPUTS” ; then
TEXINPUTS=":$TEXINPUTS:$HOME/.TeX:/usr/share/doc/.TeX:/usr/doc/.TeX"
else
TEXINPUTS=":$HOME/.TeX:/usr/share/doc/.TeX:/usr/doc/.TeX"
fi
export TEXINPUTS

Configure the default pager on SuSE Linux

if test -z “$LESS” ; then
LESS="-M -I"
LESSOPEN=“lessopen.sh %s”
LESSCLOSE=“lessclose.sh %s %s”
LESS_ADVANCED_PREPROCESSOR=“no”
if test -s /etc/lesskey.bin ; then
LESSKEY=/etc/lesskey.bin
fi
PAGER=less
MORE=-sl
export LESSOPEN LESSCLOSE LESS LESSKEY PAGER LESS_ADVANCED_PREPROCESSOR MORE
fi

Minicom

if test -z “$PROFILEREAD” ; then
MINICOM="-c on"
export MINICOM
fi

Current manpath

if test -z “$PROFILEREAD” ; then
tmp="$MANPATH"
unset MANPATH
if test -n “$tmp” ; then
MANPATH="${tmp}:test -x /usr/bin/manpath && /usr/bin/manpath -q"
else
MANPATH="test -x /usr/bin/manpath && /usr/bin/manpath -q"
fi
unset tmp
export MANPATH
fi

Some applications do not handle the XAPPLRESDIR environment properly,

when it contains more than one directory. More than one directory only

makes sense if you have a client with /usr mounted via nfs and you want

to configure applications machine dependent. Uncomment the lines below

if you want this.

#XAPPLRESDIR="$XAPPLRESDIR:/var/X11R6/app-defaults:/usr/X11R6/lib/X11/app-defaults"
#export XAPPLRESDIR

Set INFOPATH to tell xemacs where he can find the info files

if test -z “$PROFILEREAD” ; then
tmp="$INFODIR"
if test -n “$tmp” ; then
INFODIR="${tmp}:/usr/local/info:/usr/share/info:/usr/info"
else
INFODIR="/usr/local/info:/usr/share/info:/usr/info"
fi
INFOPATH=$INFODIR
unset tmp
export INFODIR INFOPATH
fi

These settings are recommended for old motif applications

if test -z “$PROFILEREAD” ; then
if [ -r /usr/share/X11/XKeysymDB ]; then
export XKEYSYMDB=/usr/share/X11/XKeysymDB
else
export XKEYSYMDB=/usr/X11R6/lib/X11/XKeysymDB
fi
if [ -d /usr/share/X11/nls ]; then
export XNLSPATH=/usr/share/X11/nls
else
export XNLSPATH=/usr/X11R6/lib/X11/nls
fi

#
# Midnight Commander needs this to run in color mode
#
COLORTERM=1
export COLORTERM

fi

For RCS

#VERSION_CONTROL=numbered
#export VERSION_CONTROL

Source the files generated by SuSEconfig

But do not source this if PROFILEREAD is already set to avoid

overriding locale variables already present in the environment

if test -z “$PROFILEREAD” ; then
test -r /etc/profile.d/sh.ssh && . /etc/profile.d/sh.ssh
test -r /etc/SuSEconfig/profile && . /etc/SuSEconfig/profile
if test -z “$SSH_SENDS_LOCALE” ; then
if test -r /etc/sysconfig/language -a -r /etc/profile.d/sh.utf8 ; then
tmp="$(. /etc/sysconfig/language; echo $AUTO_DETECT_UTF8)"
test “$tmp” = “yes” && . /etc/profile.d/sh.utf8
unset tmp
fi
fi
fi

Source profile extensions for certain packages

if test -d /etc/profile.d -a -z “$PROFILEREAD” ; then
for s in /etc/profile.d/*.sh ; do
test -r $s && . $s
done
unset s
fi

if test “$is” != “ash” ; then
#
# And now let’s see if there is a local profile
# (for options defined by your sysadmin, not SuSE Linux)
#
test -s /etc/profile.local && . /etc/profile.local
fi

System wide configuration of bourne shells like ash

if test “$is” != “ksh” -a -z “$PROFILEREAD” ; then
ENV=/etc/bash.bashrc
export ENV
fi

Avoid overwriting user settings if called twice

if test -z “$PROFILEREAD” ; then
readonly PROFILEREAD=true
export PROFILEREAD
fi

System BASH specials, maybe also good for other shells

Note that ksh always reads /etc/ksh.kshrc

if test “$is” != ksh -a -r /etc/bash.bashrc ; then
. /etc/bash.bashrc
fi
if test “$is” = “bash” -a -z “$_HOMEBASHRC” ; then
# loop detection
readonly _HOMEBASHRC=true
test -r $HOME/.bashrc && . $HOME/.bashrc
fi

KSH specials

if test “$is” = “ksh” -a -r /etc/ksh.kshrc ; then
if test ! /etc/bash.bashrc -ef /etc/ksh.kshrc ; then
test -r /etc/bash.bashrc && . /etc/bash.bashrc
fi
if test -n “$ENV” -a “$ENV” != “$HOME/.kshrc” ; then
# loop detection
readonly _HOMEKSHRC=true
test -r $HOME/.kshrc && . $HOME/.kshrc
fi
fi

End of /etc/profile

#[/code]

Obrigado!!!

Olá Zagaia blz, vc pode adicionar essas linhas ao final do arquivo /etc/profile…

Blz, qualquer coisa é só falar… :slight_smile:

Cara,
sou meiu newba ainda em linux…
como eu dou permissão para um usuario comum gravar nessa pasta /etc/ ???

ou melhor, como edito por um terminal o arquivo que eu quero?

porque dai eu posso entrar como root…

Vlw

Consegui,
perguntei uma coisa feia hahahah

tá… adicionei…
agora só falta a comunicação serial… =)

Cara,
fiz o que você pediu, reiniciei a maquina e agora não consigo entrar no modo visual…
nem como root e nem como usuario comum…

fica na tela preta, com possibilidades de varios comandos…
o que eu fazer?

Cara,
preciso mesmo da sua ajuda…
estou na mesma situação de antes… e nao quero reinstalar de novo…

Amigo,

  • Não mexa no /etc/profile (já lhe deu problemas da outra vez, você não viu?).
    Mexa no .bash_profile de seu usuário.
  • Você pode reiniciar a interface gráfica através da tal tela preta (argh), mas depende de sua versão do Unix. Acho que no SuSE é só reiniciar o X, mas não estou aqui com um SuSE disponível para dizer o comando exato. De qualquer maneira, não fique mexendo no /etc/profile; mexa apenas no seu .bash_profile, para evitar problemas.