Even more on setting up enviroment values for C-shell for Java 6

Ok, I still think I got good advise on plotting my course from :http://www.antbook.org/display/antbook/Installing+Java+6+on+Ubuntu+7.04 the problem seems to be in the details. (For some reason, this link keeps goes dead and then comes back). At this point, I think I can either put my configuration data either in /etc or /home/jonas. Further options are either to put in login or cshrc. I was going to put the set my environment variables in /ect/csh.cshrc and run an experiment all in one terminal session, but I ran across something in the man pages in csh which made me change my mind:
-l The shell is a login shell (only applicable if -l is the only flag specified).

-m Read .cshrc, regardless of its owner and group. This option is dangerous and should only be used by su(1).
I have no idea why this is dangerous, but at this point for where I’m at, it’s good enough for me.
Ok, here’s my experiment:
Fire up the terminal
Switch to c-shell using csh
run the “set” command (which btw doesn’t have a man page,go figure) to see what’s going on.
use sudo gedit to create /etc/csh.login and enter the following into the file:
setenv JAVA_HOME /usr/java/jdk
setenv JDK_HOME $JAVA_HOME
set -l path = ( $path $JAVA_HOME/bin )
check to see if its actual where I think it is
execute csh -l (which I think re-executes the login scripts)
execute set and see what displays.
[added on the fly go back to bash then back to csh with the same terminal session and execute “set”]

here are the results:
jonas@jonas-desktop:~$ csh
% set
argv ()
cwd /home/jonas
home /home/jonas
path (/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/java/jdk/bin)
prompt %
prompt2 ?
shell /bin/csh
status 0
term xterm
user jonas
% sudo gedit /etc/csh.login
[sudo] password for jonas:
% ls -a /etc/csh.login
/etc/csh.login
% csh -l
set: Variable name must begin with a letter.

% set
argv ()
cwd /home/jonas
home /home/jonas
path (/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/java/jdk/bin)
prompt %
prompt2 ?
shell /bin/csh
status 0
term xterm
user jonas
% bash
jonas@jonas-desktop:~$ csh
% set
argv ()
cwd /home/jonas
home /home/jonas
path (/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/java/jdk/bin /usr/java/jdk/bin)
prompt %
prompt2 ?
shell /bin/csh
status 0
term xterm
user jonas
%
Observations: Something didn’t work here or I’m not understanding something.
It looks like /usr/java/jdk/bin is in there twice…. I guess I don’t need:
set -l path = ( $path $JAVA_HOME/bin )
Now did I just permantly add this to my path? Next experiment, kill the file, shutdown and restart and see what happens.
According to antboy’s instructions (starting to get ticked here) when I executed set I should have seen:
JAVA_HOME =/usr/java/jdk
JDK_HOME =/usr/java/jdk
Which I don’t. Time for some more research.
Ok I found some useful information on enviroment variables here: https://help.ubuntu.com/community/EnvironmentVariables

printenv will display all environment variables. printenv JAVA_HOME will just display directory… (which it does). Ok… time to remove the login file (sudo rm /etc/csh.login) , shut down and restart to see if I permanently affected the path.
Ok… I just shut down and restart and here is what I got:
jonas@jonas-desktop:~$ csh
% set
argv ()
cwd /home/jonas
home /home/jonas
path (/usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin /usr/games /usr/java/jdk/bin)
prompt %
prompt2 ?
shell /bin/csh
status 0
term xterm
user jonas
% printenv JAVA_HOME
/usr/java/jdk
% printenv JDK_HOME
/usr/java/jdk
%

This seems to be exactly what I need. Without even creating a cshrc or login file, so I guess I’m good.Now the question I’m asking myself is: was this an excerise in futility? (I did learn a whole bunch of stuff that I didn’t know before, so I guess on that level it wasn’t)The original antbook article show how to link Java6 library. The question I’m asking myself is would the initial install have done that out of the box?? If I wind up reloading the OS from scratch I will make it a point to research this, otherwise its a mystery… All systems go for loading the opencascade library next…….

Leave a Reply

You must be logged in to post a comment.