LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-30-2014, 06:29 PM   #1
arcolombo698
Member
 
Registered: Nov 2013
Posts: 31

Rep: Reputation: Disabled
Trouble Setting JAVA_HOME environment variable for tcsh shell


Hi.

thank you in advance,

I am in need of setting three environment variables in my Linux server under the .cshrc profile for tcsh shell.


So here is what I have so far

setenv PATH home/usr/usc/jdk/1.7.0_65/:${JAVA_HOME}
setenv PATH home/usr/usc/jdk/1.7.0_65/bin:${PATH}
setenv PATH ${ANT_HOME}:/auto/rcf-proj/sa1/software


but this gives the error "JAVA_HOME undefined variable"

so I need to create an environment variable JAVA_HOME to point to the java director
and create a PATH variable that points to the bin.

lastly I need a third environment variable $ANT_HOME$ created as well..

how do I do this??

thank you in advance

AC
 
Old 07-30-2014, 10:38 PM   #2
notKlaatu
Member
 
Registered: Sep 2010
Location: Wellington, New Zealand
Distribution: Slackware, Fedora
Posts: 921

Rep: Reputation: 585Reputation: 585Reputation: 585Reputation: 585Reputation: 585Reputation: 585
On tcsh, variables are set like this:

Code:
set JAVA_HOME=/path/to/java
So place that someplace before you attempt to use ${JAVA_HOME}

Here is how I set my paths in .cshrc:

Code:
set path = ($path $HOME/bin /opt/jdk/1.8/${JAVA_HOME})
I am pretty sure you have the wrong path in your example. I could be wrong, but I've never seen a system set up with home/usr/usc/blah before. You probably mean /usr/home/usc/blah

You are also re-defining PATH three times. You don't really mean to do that. THis is more like what I imagine you want:

Code:
set JAVA_HOME=/path/to/java
set ANT_HOME=/path/to/ant
set path = ($path $HOME/bin /usr/home/usc/jdk/1.7.0_65/${JAVA_HOME} ${ANT_HOME}/auto/rcf-proj/sa1/software)
You may want to see if you have BASH installed. In my opinion, it has a lot of really nice features that make the shell a much more fun place to be, and most Linux tutorials are written with it in mind. Nothing against TCSH (I use it at work daily) but BASH is kinda nice!
 
  


Reply

Tags
java


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Having trouble setting an environment variable with a cron job PaulB0 Linux - Newbie 5 06-23-2012 03:06 AM
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined xpucto Linux - Newbie 7 06-21-2010 06:30 AM
my JAVA_HOME environment variable changes automaticly petertavenier Linux - Newbie 3 04-20-2006 03:30 AM
# ./startup.sh Neither the JAVA_HOME nor the JRE_HOME environment variable is defined Niceman2005 Linux - Newbie 3 06-29-2005 02:58 PM
Trouble setting environment variable exitsfunnel Linux - Software 4 10-06-2004 07:49 AM


All times are GMT -5. The time now is 03:54 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration