setting enviroment variables help


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers setting enviroment variables help
# 1  
Old 05-26-2009
setting enviroment variables help

Hello everyone,

I am currently trying to program in java in unix platform for the first time, so far it is OK as long as I use class libraries which come with java distribution. Unfortunately when I try to use external libraries I have to use -classpath option which I rather not doing all the time. Therefore I have tried the command 'echo $CLASSPATH' which returned nothing. I have concluded but not quite sure that the java virtual machine links to the common library behind the scene. My question is now is it save to create a new CLASSPATH variable and don't worry about overriding an existing one?

Any help is greatly appreciated and also I apologise for any grammatical mistakes, I have tried my best as English is a second language to me.

staph

-----Post Update-----

I rephrase the question with following; when the echo $somevarible return nothing does it mean the variable exist but has no value or the variable just does not exist?

-----Post Update-----

I rephrase the question with following; when the echo $somevarible return nothing does it mean the variable exist but has no value or the variable just does not exist?
# 2  
Old 05-26-2009
If on bash/ksh, use
Code:
CLASSPATH=${CLASSPATH}:/new/path/1:/new/path/2

If on csh, use
Code:
setenv CLASSPATH ${CLASSPATH}:/new/path/1:/new/path/2

This way you retain the old settings if any and add new ones as well.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

setting and displaying variables

Hello, I need a little help. 1. Edit /etc/profile so that all users are greeted upon login. 2. For the root account, set the prompt to something like "Danger!! root is doing stuff in \w", preferably in a bright color such as red or pink or in reverse video mode. Thanks for help. (4 Replies)
Discussion started by: zhshqzyc
4 Replies

2. UNIX for Dummies Questions & Answers

Setting up environment variables

Hi all, This is my first post here. I need to set up a few environment variables with a shell script. Some are hard-coded, but some should come from other commands or as input from the user. How do I do that? For example, I need to export a variable as such: export DISPLAY=127.0.0.1:8.0 ... (2 Replies)
Discussion started by: exchequer598
2 Replies

3. Solaris

Save enviroment variables

I need to save my enviroment variables,specially the $PATH.When I put it on .cshrc at next reboot I lost the configuration.How can avoid this?Thanks (2 Replies)
Discussion started by: bgf0
2 Replies

4. UNIX for Dummies Questions & Answers

Setting up variables

Hi all, I have a shell script that sets up the environment for an application running on UNIX - ksh. This script is run using: . ./script_name XX where XX is a parameter. I want to run it from another shell script but when I do it I don't get the envornment variables set up and the prompt... (3 Replies)
Discussion started by: solar_ext
3 Replies

5. UNIX for Advanced & Expert Users

setting some variables

i have a file .NAMEexport MY_NAME=JOE when i do this at the command prompt #. .NAME $echo MY_NAME $JOEi created a script called Run.sh . .NAME At the command prompt i did #sh Run.sh #echo $MY_NAMEit returns nothing. What have i missed out? (7 Replies)
Discussion started by: new2ss
7 Replies

6. UNIX for Dummies Questions & Answers

Enviroment variables...

Hi guys, thanks in advance for this easy answer.... :s Ok I am trying to output the enviroment varable for host in Solaris. I have tried $HOST, $HOST_NAME, $HOSTNAME carn't find it anywhere, does someone want to put me out of my misary and tell me what it is??? :confused: :eek: Thanks... (2 Replies)
Discussion started by: B14speedfreak
2 Replies

7. UNIX for Dummies Questions & Answers

Get enviroment variables into AWK, but not quite that simple!

Hi, I have a script which loops through a file and based on the fields in the file does certain things. I'm just testing the final version and come up against a problem. One of the things is to copy files, so the line in the release.file would look like this. COPY my_file $COPY_DIR 777 ... (1 Reply)
Discussion started by: m1l
1 Replies

8. Shell Programming and Scripting

Setting variables in a function

I'm not quite sure what I'm doing wrong here. I've go several jobs which print reports. Occassionally a printer will break down and reports need to be move to another printer. Rather than hard code the printer names in our scripts I'm trying to set these programatically using our function... (1 Reply)
Discussion started by: BCarlson
1 Replies

9. Shell Programming and Scripting

Setting up Environment Variables

Hi all, I am trying to set up some variables in a shell script. The variables contain values of various paths needed to run a java module. The problem is the variables dont seem to be setting at all. here is what i am trying to do : JAR_HOME=/home/was5/bdcms/scheduledjobs/lib export... (6 Replies)
Discussion started by: rpandey
6 Replies

10. AIX

Setting Variables not working

Hi all, I am trying to set up some variables in a shell script. The variables contain values of various paths needed to run a java module. The problem is the variables dont seem to be setting at all. here is what i am trying to do : JAR_HOME=/home/was5/bdcms/scheduledjobs/lib export... (1 Reply)
Discussion started by: rpandey
1 Replies
Login or Register to Ask a Question