• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1385
  • Last Modified:

ubuntu: /etc/environment and .profile

Hi: In Ubuntu 8.10, I intalled tomcat and Eclipse. For eclipse, it needs to set up JAVA_HOME. And for tomcat, it needs to set up CATALINA_HOME. What's the difference if I put these variables in between .Profile and /etc/environment file.

0
JianJunShen
Asked:
JianJunShen
  • 5
  • 3
  • 2
  • +2
5 Solutions
 
CEHJCommented:
>>/etc/environment file.

I've never heard of the above, but if you want it to be truly global, and for all users, i'd suggest

/etc/profile
0
 
Maciej SsysadminCommented:
As eclipse is application run by user (it's not a daemon) you may put needed variables into your ~/.profile file.

Tomcat is service and is run right after your server boots - there is no need to have some users logged in, so I suggest defining needed variables in script which is used to start tomcat (probably /etc/init.d/tomcat).

/etc/environment is I think nonstandard file for keeping variables in *nix systems. It is probably just read in one of other - standard - files (/etc/profile, ~/.profile, /etc/bash*, or something like that).
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
objectsCommented:
/etc/environment is right place for it.
It is used for system wide env setting, which JAVE_HOME and CATALINA_HOME are

0
 
objectsCommented:
CATALINA_HOME could also go instead in

/etc/default/tomcatx.y

0
 
objectsCommented:
> /etc/profile

for the benefit of others reading this q the accepted answer is incorrect, you should *not* put it in profile.


0
 
CEHJCommented:
:-)
0
 
budfrog532Commented:
Had to declare DLC for Progress installation on Ubuntu.
/etc/profile did not work
/etc/environment worked well for me
0
 
objectsCommented:
> /etc/profile did not work

yes I pointed that out above. The accepted comment is wrong.
0
 
budfrog532Commented:
>> yes I pointed that out above. The accepted comment is wrong.

gee, thanks for adding that.  Obviously, I am able to read, I was merely adding the fact that this helped me solve a specific problem that is not easily Googled.

Next time I will just grab a solution and go.
0
 
objectsCommented:
I was just clarifying that the accepted comment is wrong and misleading for others reading this question.
Unfortunately a lot of users just read the accepted comment, and then get confused when it doesn't work.
0
 
CEHJCommented:
>>/etc/profile did not work

It should have worked. Did you 'export' the setting?

Read the following excellent article on env vars. The author actually mentions /etc/profile before /etc/environment, possibly because the latter is non-standard, although he seems to prefer it

https://help.ubuntu.com/community/EnvironmentVariables
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 5
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now