LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Adjusting my profile for java/jGRASP use (https://www.linuxquestions.org/questions/linux-software-2/adjusting-my-profile-for-java-jgrasp-use-301936/)

Beeker 03-15-2005 01:38 PM

Adjusting my profile for java/jGRASP use
 
I have been having some problems lately trying to get jGRASP to work on my newly installed linux box, though I am in contact with the project leader I figure more suggestions couldn't hurt.

Here is what I get when I try to run jGRASP:

[root@localhost root]# /root/jgrasp/bin/java
[root@localhost root]#

jGRASP exec error: command "java" not found.
Unable to run jgrasp.

I was informed that I need to adjust my bash profile (which seems to be /etc/profile for my system release), but so far I have not gotten it to work. Please keep in mind you are dealing with a complete newb to the linux system, so telling me to do things without a walkthrough will probably get me in trouble, that being said, here is my information-

jGRASP directory- /usr/java/jgrasp
Java directory- /usr/java/jdk1.5.0_02
Suggested addition to /etc/profile- PATH=$PATH:/path_to_java/bin/java

/etc/profile (items I have added in red)-

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrip -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
PATH=$PATH:/usr/java/jdk1.5.0_02/bin/java

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
unset pathmunge




Thank you in advance for any help you can provide regarding my problem!

Matir 03-15-2005 01:44 PM

First off, path should be a list of directories, not files. So you'd want /path/to/java/bin, without the final "java". Secondly, I wouldn't mess with /etc/profile, I'd modify .profile or .bash_profile for this.

Beeker 03-15-2005 01:58 PM

Hah, see this is exactly where the learning curve is biting me in the butt...

There is a diference between bash and .bash?

I have never been able to find a .bash file, nor a bash_profile file (with or without the '.').

I went to the /etc/bashrc file and the very first lines were:

# /etc/bashrc

# System wide functions and aliases
# Environment stuff goes in /etc/profile

Since I was told that I needed the environmental stuff, I went to /etc/profile.


I have tried removing the last /java from the path, but also with no effect.

Beeker 03-15-2005 02:26 PM

Quick edit.

After double-checking to make sure what I typed above was correct, I found .bash_profile

It exists in three locations-

/root/
/etc/skel/
/home/daniel/

I assume I only need to adjust the one under /etc/skel/ ?

Going to give it a try now...

Beeker 03-15-2005 02:50 PM

Holy crap, it worked!

OK, for future refrence in case somebody else runs into this problem, adjustments had to be made in the .bash_profile AND under /ect/profile, here is what mine look like:

# /etc/profile

# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc

pathmunge () {
if ! echo $PATH | /bin/egrip -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
PATH=$PATH:/usr/java/jdk1.5.0_02/bin:$PATH

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

export JAVAHOME=/usr/java/jdk1.5.0_02
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


For the .bash_profile, I added the following line wherever I could find the file (find -name .bash_profile). Don't know if that is needed or not, but I'm not arguing with the results.


# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
.~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin
PATH=$PATH:/usr/java/jdk1.5.0_02/bin/java

export PATH
unset USERNAME



Hopefully this will help some other poor linux newb who needs to get his jGRASP to work.

Thank you for the suggestions, if nothing else they definately got my mind on the right track!


All times are GMT -5. The time now is 09:16 AM.