LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 07-26-2004, 05:12 PM   #1
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Rep: Reputation: 0
Setting up my java classpath in redhat


I am trying to set my PATH variable on my system so I don't have tp type in thewhole path any time I want to run a java program like so:

/usr/java/j2sdk1.4.2/bin/java myProgram


I went into my /etc/profile file and entered the following lines

PATH=$PATH:/usr/java/j2sdk1.4.2/bin

export PATH


when I open a terminal and type echo $PATH I don't see the new path that I added


can someone please suggest what I doing wrong.

Thanks
 
Old 07-26-2004, 05:24 PM   #2
darin3200
LQ Guru
 
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153

Rep: Reputation: 45
As root run 'source /etc/profile' otherwise it is using what is already loaded
 
Old 07-26-2004, 05:29 PM   #3
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Original Poster
Rep: Reputation: 0
Thanks a lot darin3200 it's working fine now
 
Old 07-27-2004, 11:41 AM   #4
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Original Poster
Rep: Reputation: 0
Unhappy

Hey Darin3200

When I close my terminal and start a new one the newly set values of $PATH and $CLASSPATH dissappear.


do I have to run /etc/profile each time I want the class path set?



Thanks
 
Old 07-27-2004, 11:52 AM   #5
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Maybe you can edit the shortcut that starts the console. For example you can add the konsole --ls line to command part of your konsole shortcut and then it'll start a login console each time you open a new one.
 
Old 07-27-2004, 12:26 PM   #6
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Original Poster
Rep: Reputation: 0


I did what you suggested and now my terminal will not open anymore it opens and runs some command and shuts off automatically I can't get it to open up .


Any suggestions?
 
Old 07-27-2004, 01:29 PM   #7
working2hard
LQ Newbie
 
Registered: Jul 2004
Posts: 20

Original Poster
Rep: Reputation: 0
can some one please help me with this
 
Old 07-27-2004, 01:52 PM   #8
psiakr3w
LQ Newbie
 
Registered: Jul 2004
Posts: 27

Rep: Reputation: 15
From what info I've gathered using google, it's quite possible that /etc/profile does not get sourced everytime you log in as the shell is supposedly bypassed if you use a display manager (see last post of http://www.linuxquestions.org/questi...hreadid=164709).

So I'd recommend that you instead append your export statement (export PATH=$PATH:...) to your ~/.bashrc file instead, and see if that makes a difference.
 
Old 07-28-2004, 03:24 AM   #9
barisdemiray
Member
 
Registered: Sep 2003
Location: Ankara/Turkey
Distribution: Slackware
Posts: 155

Rep: Reputation: 30
Quote:
Originally posted by working2hard
can some one please help me with this
Sorry.. I wrote exactly what i use and it works great for me. I'm executing some prompt code and it works only when i use konsole --ls (not with konsole). Maybe you should add your environment variables to the ~/.bashrc file (No guarantee :-)) or check ~./.bashrc and ~./.bash_profile to find out any script causing console to close.
 
Old 07-28-2004, 10:15 AM   #10
darin3200
LQ Guru
 
Registered: Dec 2002
Distribution: Gentoo!
Posts: 1,153

Rep: Reputation: 45
You might want to check out the suggesstion of the .bashrc but your /etc/profile should load everytime you start a terminal. What distro are you using, also post your /etc/profile.
Here's mine
Code:
# /etc/profile:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/profile,v 1.23 2003/04/29 21:23:18 azarah Exp $

if [ -e "/etc/profile.env" ]
then
	. /etc/profile.env
fi

# 077 would be more secure, but 022 is generally quite realistic
umask 022

if [ `/usr/bin/whoami` = 'root' ]
then
	# Do not set PS1 for dumb terminals
	if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
	then
		export PS1='\[\033[01;31m\]\h \[\033[01;34m\]\W \$ \[\033[00m\]'
	fi
	export PATH="/bin:/sbin:/usr/bin:/usr/sbin:${ROOTPATH}"
else
	# Do not set PS1 for dumb terminals
	if [ "$TERM" != 'dumb'  ] && [ -n "$BASH" ]
	then
		export PS1='\[\033[01;32m\]\u@\h \[\033[01;34m\]\W \$ \[\033[00m\]'
	fi
	export PATH="/bin:/home/darinf/.mozillasunbird:/home/darinf/.firefox:/home/darinf/.thunderbird:/usr/bin:${PATH}"
fi
unset ROOTPATH

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]
then
	export INPUTRC="/etc/inputrc"
fi

# Extract the value of EDITOR
[ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`"
[ -z "$EDITOR" ] && EDITOR="`. /etc/conf.d/basic 2>/dev/null; echo $EDITOR`"
[ -z "$EDITOR" ] && EDITOR="/bin/nano"
export EDITOR

Last edited by darin3200; 07-28-2004 at 10:18 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to set java classpath on Redhat 9? antony_csf Programming 9 11-26-2004 05:48 AM
setting classpath for java in mdk9.2 perryub Linux - Newbie 2 05-07-2004 04:02 PM
setting java classpath... brutal_brad Linux - Newbie 7 09-21-2003 02:52 PM
How to set classpath for java jolly Linux - Software 3 04-22-2003 10:02 PM
ClASSPATH variable for Java oulevon Linux - General 1 02-28-2001 08:25 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration