LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 11-21-2012, 04:06 PM   #1
bard
LQ Newbie
 
Registered: Oct 2012
Distribution: Debian
Posts: 10

Rep: Reputation: Disabled
exporting variables


I have created and exported a variable.

Code:
export var=blah123
Now I want to access this variable by a java servlet running on a tomcat sever on the same machine.

Code:
System.getEnv("var")
But this keeps returning a null value. I have already searched the web but found the answers very confusing.
 
Old 11-21-2012, 04:51 PM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
Has this java/tomcat process been started by the same shell in which you did the export? Unrelated processes don't obtain variable settings from each other.
 
Old 11-23-2012, 05:53 AM   #3
bard
LQ Newbie
 
Registered: Oct 2012
Distribution: Debian
Posts: 10

Original Poster
Rep: Reputation: Disabled
no, it was not started by the same shell.
should I add this variable in a tomcat configuration file? if so, which file?
thanx for your help!
 
Old 11-23-2012, 06:14 AM   #4
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,369

Rep: Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753Reputation: 2753
You certainly need to put it further up the same process tree or in a cfg file.
export only enables vars to be seen further down the same process tree.
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] script not exporting variables divyashree Programming 17 06-08-2011 05:27 AM
exporting variables gecoool Programming 2 10-25-2005 01:17 AM
Exporting variables through scripts rammya Programming 1 04-14-2004 10:24 AM
exporting variables in Perl nbp Programming 1 11-18-2003 08:35 AM
exporting global variables neo77777 Programming 6 09-18-2002 01:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 07:39 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
Open Source Consulting | Domain Registration