Find the answer to your Linux question:
Results 1 to 4 of 4
I installed Java on a server and anytime I have to start or stop a service that requires the $JAVA_HOME variable I have to manually set it with the export ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux User cheesecake42's Avatar
    Join Date
    Jan 2007
    Location
    Orlando, FL
    Posts
    370

    Permanently Setting Environmental Variables


    I installed Java on a server and anytime I have to start or stop a service that requires the $JAVA_HOME variable I have to manually set it with the export command such as:
    Code:
    export JAVA_HOME=/usr/java-jdk1.6.0_21
    How can I permanently set this variable?

    Have some smileys:

  2. #2
    Just Joined! jr0sco's Avatar
    Join Date
    Aug 2010
    Location
    Australia
    Posts
    41
    What service are you start/stopping?

    Add:
    Code:
    export JAVA_HOME=/usr/java-jdk1.6.0_21
    to the init.d script of that service, these script are located in /etc/init.d directory

  3. #3
    Linux User cheesecake42's Avatar
    Join Date
    Jan 2007
    Location
    Orlando, FL
    Posts
    370
    Its JIRA built into a tomcat web server so there is no init script. The service has to be started manually with a shell script. Can I just add the export line to the user's .bashrc?

  4. #4
    Just Joined! jr0sco's Avatar
    Join Date
    Aug 2010
    Location
    Australia
    Posts
    41
    Quote Originally Posted by cheesecake42 View Post
    Can I just add the export line to the user's .bashrc?
    Yes this will run when the user logs on. You could also add it to the script that you run manually.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •