Tomcat does not recognize JAVA_HOME The 2019 Stack Overflow Developer Survey Results Are InWhy ~/.bash_profile is not getting sourced when opening a terminal?Environment variable is set but not accessible on serverPATH is not getting exported by default in Ubuntu 12.04Some error messages displayed when I start terminal (both as root and as normal user)How to Verify JAVA_HOME pathPath given in Environment variable shows empty after rebootHow to set JAVA_HOME for all users for “elasticsearch” program?Why I can't use the CATALINA_HOME environment variable?Tomcat 7 as a service under systemctl in 18.04 -configuration?[SOLVED]How to set up JAVA_HOME when connect through ssh and using Bourne compatible Shell?
What is the most effective way of iterating a std::vector and why?
If a Druid sees an animal’s corpse, can they Wild Shape into that animal?
What did it mean to "align" a radio?
When should I buy a clipper card after flying to OAK?
For what reasons would an animal species NOT cross a *horizontal* land bridge?
What does ひと匙 mean in this manga and has it been used colloquially?
Deal with toxic manager when you can't quit
Is a "Democratic" Oligarchy-Style System Possible?
What are the motivations for publishing new editions of an existing textbook, beyond new discoveries in a field?
Looking for Correct Greek Translation for Heraclitus
Why didn't the Event Horizon Telescope team mention Sagittarius A*?
Why did Acorn's A3000 have red function keys?
Time travel alters history but people keep saying nothing's changed
What is the motivation for a law requiring 2 parties to consent for recording a conversation
Why can Shazam fly?
What is the accessibility of a package's `Private` context variables?
Is an up-to-date browser secure on an out-of-date OS?
How come people say “Would of”?
Why isn't airport relocation done gradually?
Delete all lines which don't have n characters before delimiter
Distributing a matrix
slides for 30min~1hr skype tenure track application interview
Why hard-Brexiteers don't insist on a hard border to prevent illegal immigration after Brexit?
What do the Banks children have against barley water?
Tomcat does not recognize JAVA_HOME
The 2019 Stack Overflow Developer Survey Results Are InWhy ~/.bash_profile is not getting sourced when opening a terminal?Environment variable is set but not accessible on serverPATH is not getting exported by default in Ubuntu 12.04Some error messages displayed when I start terminal (both as root and as normal user)How to Verify JAVA_HOME pathPath given in Environment variable shows empty after rebootHow to set JAVA_HOME for all users for “elasticsearch” program?Why I can't use the CATALINA_HOME environment variable?Tomcat 7 as a service under systemctl in 18.04 -configuration?[SOLVED]How to set up JAVA_HOME when connect through ssh and using Bourne compatible Shell?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I've installed Ubuntu 14.04 Server, extracted JDK1.8u5 and Tomcat7, and added the following to .profile (I also tried adding it to .bashrc with similar [non-] results):
export JAVA_HOME=/opt/java/jdk1.8.0_05
export PATH=$PATH:$JAVA_HOME/bin
when I run echo $JAVA_HOME
I get the expected result of /opt/java/jdk1.8.0_05
. I can also run java -version
and get the correct response from Java. so far so good.
so now I try to startup Tomcat (tried also catalina.sh), and I get the following:
user@ubuntu:~$ sudo /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
but... I just tried echo $JAVA_HOME
and it worked?
bash java environment-variables tomcat
add a comment |
I've installed Ubuntu 14.04 Server, extracted JDK1.8u5 and Tomcat7, and added the following to .profile (I also tried adding it to .bashrc with similar [non-] results):
export JAVA_HOME=/opt/java/jdk1.8.0_05
export PATH=$PATH:$JAVA_HOME/bin
when I run echo $JAVA_HOME
I get the expected result of /opt/java/jdk1.8.0_05
. I can also run java -version
and get the correct response from Java. so far so good.
so now I try to startup Tomcat (tried also catalina.sh), and I get the following:
user@ubuntu:~$ sudo /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
but... I just tried echo $JAVA_HOME
and it worked?
bash java environment-variables tomcat
add a comment |
I've installed Ubuntu 14.04 Server, extracted JDK1.8u5 and Tomcat7, and added the following to .profile (I also tried adding it to .bashrc with similar [non-] results):
export JAVA_HOME=/opt/java/jdk1.8.0_05
export PATH=$PATH:$JAVA_HOME/bin
when I run echo $JAVA_HOME
I get the expected result of /opt/java/jdk1.8.0_05
. I can also run java -version
and get the correct response from Java. so far so good.
so now I try to startup Tomcat (tried also catalina.sh), and I get the following:
user@ubuntu:~$ sudo /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
but... I just tried echo $JAVA_HOME
and it worked?
bash java environment-variables tomcat
I've installed Ubuntu 14.04 Server, extracted JDK1.8u5 and Tomcat7, and added the following to .profile (I also tried adding it to .bashrc with similar [non-] results):
export JAVA_HOME=/opt/java/jdk1.8.0_05
export PATH=$PATH:$JAVA_HOME/bin
when I run echo $JAVA_HOME
I get the expected result of /opt/java/jdk1.8.0_05
. I can also run java -version
and get the correct response from Java. so far so good.
so now I try to startup Tomcat (tried also catalina.sh), and I get the following:
user@ubuntu:~$ sudo /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined
At least one of these environment variable is needed to run this program
but... I just tried echo $JAVA_HOME
and it worked?
bash java environment-variables tomcat
bash java environment-variables tomcat
edited May 18 '14 at 22:52
Braiam
52.6k20138223
52.6k20138223
asked May 18 '14 at 17:45
isapirisapir
183129
183129
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
There is a help text in catalina.sh
. I will quote it here:
# Do not set the variables in this script. Instead put them into a script
# setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
#
# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
# Ensure that any user defined CLASSPATH variables are not used on startup,
# but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=
if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
. "$CATALINA_BASE/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
. "$CATALINA_HOME/bin/setenv.sh"
fi
When you starting tomcat
using catalina.sh
, it searching for file setenv.sh
and sourcing it. It is searching in CATALINA_HOME
or CATALINA_BASE
.
So the better way to set JAVA_HOME
for the tomcat
is:
- Create a script named
setenv.sh
in the folderCATALINA_BASE/bin
, if it does not exist already. Add this line to
setenv.sh
export JAVA_HOME=/opt/java/jdk1.8.0_05
Make it executable.
Why you should use this solution:
Setting environment variable in script is safer. Always try to set variables as locally as possible. Try do not use /etc/environment
, /etc/profile
and others if you really do not need Global Environment Variable
. Setting JAVA_HOME
in setenv.sh
gives you ability to use different tomcats with different applications that need different version of java
, but running by one user. Other user environment would not be affected by you.
add a comment |
Since you have set the environment variable for your own user and not for the superuser, you have two options:
You will have to export the variable using
-E
option as follows:sudo -E /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Note that this will export all environment variables while running the command. This is not preferred since the normal users environment is spilled out when you run the command as root. This is not desirable.
Export the variable in
root's.bashrc
/etc/enviroment
file. Open a terminal and type:sudo nano /etc/environment
and enter your administrative password, and add the following lines to the end of the file:
JAVA_HOME=/opt/java/jdk1.8.0_05
PATH=$PATH:$JAVA_HOME/binand then
source /etc/environment
or restart your machine and then retry the command you were using.
Update:
This answer provided hints as two why step 2 wouldn't work, sudo
would reset the environment and provide a secure path, so all global variables are reset. A workaround would be to use
sudo su
and then execute command which uses the set environment variables.
1
Thanks @Jobin -- option 1 works so I upvoted your answer. I will now check option 2, which is my preferred solution, and if it works I will accept your answer.
– isapir
May 18 '14 at 17:57
I added the commands to/root/.bashrc
with nano, as you suggested, but callinguser@ubuntu:~$ source /root/.bashrc
results in-bash: /root/.bashrc: Permission denied
and trying it with sudo yieldssudo: source: command not found
. retrying the original command at this point brings me back to point 0.
– isapir
May 18 '14 at 18:05
@Igal: Edited my answer to solve that issue, you should first usesudo -i
before yousource
. Thanks for pointing that out.
– jobin
May 18 '14 at 18:06
ok, pardon the newbie questions, but how do I exit thesudo -i
once I'vet called source? without exiting I am getting the original error message...
– isapir
May 18 '14 at 18:08
@Igal: Just press Ctrl + d or typeexit
.
– jobin
May 18 '14 at 18:09
|
show 8 more comments
The solution I was looking for is in /etc/environment
which, as specified at EnvironmentVariables, does not process scripts and does not expand variables, so adding the following (without export) did the trick:
JAVA_HOME=/opt/java/jdk1.8.0_05
Then I rebooted the system for the changes to take affect.
add a comment |
I added JAVA_HOME in tomcat7.service
script as setenv.sh
was not get sourced by catalina.sh
Steps:
1.Open tomcat7 service script file
sudo gedit /etc/init.d/tomcat7
2.Set JAVA_HOME
.
.
.
JAVA_HOME=/usr/lib/jvm/java-8-oracle
# Directory where the Tomcat 6 binary distribution resides
CATALINA_HOME=/usr/share/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
# Use the Java security manager? (yes/no)
TOMCAT7_SECURITY=no
3.Start tomcat7 service
sudo service tomcat7 status
New contributor
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "89"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f468772%2ftomcat-does-not-recognize-java-home%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
There is a help text in catalina.sh
. I will quote it here:
# Do not set the variables in this script. Instead put them into a script
# setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
#
# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
# Ensure that any user defined CLASSPATH variables are not used on startup,
# but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=
if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
. "$CATALINA_BASE/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
. "$CATALINA_HOME/bin/setenv.sh"
fi
When you starting tomcat
using catalina.sh
, it searching for file setenv.sh
and sourcing it. It is searching in CATALINA_HOME
or CATALINA_BASE
.
So the better way to set JAVA_HOME
for the tomcat
is:
- Create a script named
setenv.sh
in the folderCATALINA_BASE/bin
, if it does not exist already. Add this line to
setenv.sh
export JAVA_HOME=/opt/java/jdk1.8.0_05
Make it executable.
Why you should use this solution:
Setting environment variable in script is safer. Always try to set variables as locally as possible. Try do not use /etc/environment
, /etc/profile
and others if you really do not need Global Environment Variable
. Setting JAVA_HOME
in setenv.sh
gives you ability to use different tomcats with different applications that need different version of java
, but running by one user. Other user environment would not be affected by you.
add a comment |
There is a help text in catalina.sh
. I will quote it here:
# Do not set the variables in this script. Instead put them into a script
# setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
#
# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
# Ensure that any user defined CLASSPATH variables are not used on startup,
# but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=
if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
. "$CATALINA_BASE/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
. "$CATALINA_HOME/bin/setenv.sh"
fi
When you starting tomcat
using catalina.sh
, it searching for file setenv.sh
and sourcing it. It is searching in CATALINA_HOME
or CATALINA_BASE
.
So the better way to set JAVA_HOME
for the tomcat
is:
- Create a script named
setenv.sh
in the folderCATALINA_BASE/bin
, if it does not exist already. Add this line to
setenv.sh
export JAVA_HOME=/opt/java/jdk1.8.0_05
Make it executable.
Why you should use this solution:
Setting environment variable in script is safer. Always try to set variables as locally as possible. Try do not use /etc/environment
, /etc/profile
and others if you really do not need Global Environment Variable
. Setting JAVA_HOME
in setenv.sh
gives you ability to use different tomcats with different applications that need different version of java
, but running by one user. Other user environment would not be affected by you.
add a comment |
There is a help text in catalina.sh
. I will quote it here:
# Do not set the variables in this script. Instead put them into a script
# setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
#
# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
# Ensure that any user defined CLASSPATH variables are not used on startup,
# but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=
if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
. "$CATALINA_BASE/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
. "$CATALINA_HOME/bin/setenv.sh"
fi
When you starting tomcat
using catalina.sh
, it searching for file setenv.sh
and sourcing it. It is searching in CATALINA_HOME
or CATALINA_BASE
.
So the better way to set JAVA_HOME
for the tomcat
is:
- Create a script named
setenv.sh
in the folderCATALINA_BASE/bin
, if it does not exist already. Add this line to
setenv.sh
export JAVA_HOME=/opt/java/jdk1.8.0_05
Make it executable.
Why you should use this solution:
Setting environment variable in script is safer. Always try to set variables as locally as possible. Try do not use /etc/environment
, /etc/profile
and others if you really do not need Global Environment Variable
. Setting JAVA_HOME
in setenv.sh
gives you ability to use different tomcats with different applications that need different version of java
, but running by one user. Other user environment would not be affected by you.
There is a help text in catalina.sh
. I will quote it here:
# Do not set the variables in this script. Instead put them into a script
# setenv.sh in CATALINA_BASE/bin to keep your customizations separate.
#
# JAVA_HOME Must point at your Java Development Kit installation.
# Required to run the with the "debug" argument.
# Ensure that any user defined CLASSPATH variables are not used on startup,
# but allow them to be specified in setenv.sh, in rare case when it is needed.
CLASSPATH=
if [ -r "$CATALINA_BASE/bin/setenv.sh" ]; then
. "$CATALINA_BASE/bin/setenv.sh"
elif [ -r "$CATALINA_HOME/bin/setenv.sh" ]; then
. "$CATALINA_HOME/bin/setenv.sh"
fi
When you starting tomcat
using catalina.sh
, it searching for file setenv.sh
and sourcing it. It is searching in CATALINA_HOME
or CATALINA_BASE
.
So the better way to set JAVA_HOME
for the tomcat
is:
- Create a script named
setenv.sh
in the folderCATALINA_BASE/bin
, if it does not exist already. Add this line to
setenv.sh
export JAVA_HOME=/opt/java/jdk1.8.0_05
Make it executable.
Why you should use this solution:
Setting environment variable in script is safer. Always try to set variables as locally as possible. Try do not use /etc/environment
, /etc/profile
and others if you really do not need Global Environment Variable
. Setting JAVA_HOME
in setenv.sh
gives you ability to use different tomcats with different applications that need different version of java
, but running by one user. Other user environment would not be affected by you.
edited Mar 5 '16 at 8:44
muru
1
1
answered May 18 '14 at 18:41
c0rpc0rp
7,03612657
7,03612657
add a comment |
add a comment |
Since you have set the environment variable for your own user and not for the superuser, you have two options:
You will have to export the variable using
-E
option as follows:sudo -E /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Note that this will export all environment variables while running the command. This is not preferred since the normal users environment is spilled out when you run the command as root. This is not desirable.
Export the variable in
root's.bashrc
/etc/enviroment
file. Open a terminal and type:sudo nano /etc/environment
and enter your administrative password, and add the following lines to the end of the file:
JAVA_HOME=/opt/java/jdk1.8.0_05
PATH=$PATH:$JAVA_HOME/binand then
source /etc/environment
or restart your machine and then retry the command you were using.
Update:
This answer provided hints as two why step 2 wouldn't work, sudo
would reset the environment and provide a secure path, so all global variables are reset. A workaround would be to use
sudo su
and then execute command which uses the set environment variables.
1
Thanks @Jobin -- option 1 works so I upvoted your answer. I will now check option 2, which is my preferred solution, and if it works I will accept your answer.
– isapir
May 18 '14 at 17:57
I added the commands to/root/.bashrc
with nano, as you suggested, but callinguser@ubuntu:~$ source /root/.bashrc
results in-bash: /root/.bashrc: Permission denied
and trying it with sudo yieldssudo: source: command not found
. retrying the original command at this point brings me back to point 0.
– isapir
May 18 '14 at 18:05
@Igal: Edited my answer to solve that issue, you should first usesudo -i
before yousource
. Thanks for pointing that out.
– jobin
May 18 '14 at 18:06
ok, pardon the newbie questions, but how do I exit thesudo -i
once I'vet called source? without exiting I am getting the original error message...
– isapir
May 18 '14 at 18:08
@Igal: Just press Ctrl + d or typeexit
.
– jobin
May 18 '14 at 18:09
|
show 8 more comments
Since you have set the environment variable for your own user and not for the superuser, you have two options:
You will have to export the variable using
-E
option as follows:sudo -E /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Note that this will export all environment variables while running the command. This is not preferred since the normal users environment is spilled out when you run the command as root. This is not desirable.
Export the variable in
root's.bashrc
/etc/enviroment
file. Open a terminal and type:sudo nano /etc/environment
and enter your administrative password, and add the following lines to the end of the file:
JAVA_HOME=/opt/java/jdk1.8.0_05
PATH=$PATH:$JAVA_HOME/binand then
source /etc/environment
or restart your machine and then retry the command you were using.
Update:
This answer provided hints as two why step 2 wouldn't work, sudo
would reset the environment and provide a secure path, so all global variables are reset. A workaround would be to use
sudo su
and then execute command which uses the set environment variables.
1
Thanks @Jobin -- option 1 works so I upvoted your answer. I will now check option 2, which is my preferred solution, and if it works I will accept your answer.
– isapir
May 18 '14 at 17:57
I added the commands to/root/.bashrc
with nano, as you suggested, but callinguser@ubuntu:~$ source /root/.bashrc
results in-bash: /root/.bashrc: Permission denied
and trying it with sudo yieldssudo: source: command not found
. retrying the original command at this point brings me back to point 0.
– isapir
May 18 '14 at 18:05
@Igal: Edited my answer to solve that issue, you should first usesudo -i
before yousource
. Thanks for pointing that out.
– jobin
May 18 '14 at 18:06
ok, pardon the newbie questions, but how do I exit thesudo -i
once I'vet called source? without exiting I am getting the original error message...
– isapir
May 18 '14 at 18:08
@Igal: Just press Ctrl + d or typeexit
.
– jobin
May 18 '14 at 18:09
|
show 8 more comments
Since you have set the environment variable for your own user and not for the superuser, you have two options:
You will have to export the variable using
-E
option as follows:sudo -E /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Note that this will export all environment variables while running the command. This is not preferred since the normal users environment is spilled out when you run the command as root. This is not desirable.
Export the variable in
root's.bashrc
/etc/enviroment
file. Open a terminal and type:sudo nano /etc/environment
and enter your administrative password, and add the following lines to the end of the file:
JAVA_HOME=/opt/java/jdk1.8.0_05
PATH=$PATH:$JAVA_HOME/binand then
source /etc/environment
or restart your machine and then retry the command you were using.
Update:
This answer provided hints as two why step 2 wouldn't work, sudo
would reset the environment and provide a secure path, so all global variables are reset. A workaround would be to use
sudo su
and then execute command which uses the set environment variables.
Since you have set the environment variable for your own user and not for the superuser, you have two options:
You will have to export the variable using
-E
option as follows:sudo -E /opt/tomcat7/apache-tomcat-7.0.53/bin/startup.sh
Note that this will export all environment variables while running the command. This is not preferred since the normal users environment is spilled out when you run the command as root. This is not desirable.
Export the variable in
root's.bashrc
/etc/enviroment
file. Open a terminal and type:sudo nano /etc/environment
and enter your administrative password, and add the following lines to the end of the file:
JAVA_HOME=/opt/java/jdk1.8.0_05
PATH=$PATH:$JAVA_HOME/binand then
source /etc/environment
or restart your machine and then retry the command you were using.
Update:
This answer provided hints as two why step 2 wouldn't work, sudo
would reset the environment and provide a secure path, so all global variables are reset. A workaround would be to use
sudo su
and then execute command which uses the set environment variables.
edited May 19 '14 at 7:22
answered May 18 '14 at 17:53
jobinjobin
19.7k1279109
19.7k1279109
1
Thanks @Jobin -- option 1 works so I upvoted your answer. I will now check option 2, which is my preferred solution, and if it works I will accept your answer.
– isapir
May 18 '14 at 17:57
I added the commands to/root/.bashrc
with nano, as you suggested, but callinguser@ubuntu:~$ source /root/.bashrc
results in-bash: /root/.bashrc: Permission denied
and trying it with sudo yieldssudo: source: command not found
. retrying the original command at this point brings me back to point 0.
– isapir
May 18 '14 at 18:05
@Igal: Edited my answer to solve that issue, you should first usesudo -i
before yousource
. Thanks for pointing that out.
– jobin
May 18 '14 at 18:06
ok, pardon the newbie questions, but how do I exit thesudo -i
once I'vet called source? without exiting I am getting the original error message...
– isapir
May 18 '14 at 18:08
@Igal: Just press Ctrl + d or typeexit
.
– jobin
May 18 '14 at 18:09
|
show 8 more comments
1
Thanks @Jobin -- option 1 works so I upvoted your answer. I will now check option 2, which is my preferred solution, and if it works I will accept your answer.
– isapir
May 18 '14 at 17:57
I added the commands to/root/.bashrc
with nano, as you suggested, but callinguser@ubuntu:~$ source /root/.bashrc
results in-bash: /root/.bashrc: Permission denied
and trying it with sudo yieldssudo: source: command not found
. retrying the original command at this point brings me back to point 0.
– isapir
May 18 '14 at 18:05
@Igal: Edited my answer to solve that issue, you should first usesudo -i
before yousource
. Thanks for pointing that out.
– jobin
May 18 '14 at 18:06
ok, pardon the newbie questions, but how do I exit thesudo -i
once I'vet called source? without exiting I am getting the original error message...
– isapir
May 18 '14 at 18:08
@Igal: Just press Ctrl + d or typeexit
.
– jobin
May 18 '14 at 18:09
1
1
Thanks @Jobin -- option 1 works so I upvoted your answer. I will now check option 2, which is my preferred solution, and if it works I will accept your answer.
– isapir
May 18 '14 at 17:57
Thanks @Jobin -- option 1 works so I upvoted your answer. I will now check option 2, which is my preferred solution, and if it works I will accept your answer.
– isapir
May 18 '14 at 17:57
I added the commands to
/root/.bashrc
with nano, as you suggested, but calling user@ubuntu:~$ source /root/.bashrc
results in -bash: /root/.bashrc: Permission denied
and trying it with sudo yields sudo: source: command not found
. retrying the original command at this point brings me back to point 0.– isapir
May 18 '14 at 18:05
I added the commands to
/root/.bashrc
with nano, as you suggested, but calling user@ubuntu:~$ source /root/.bashrc
results in -bash: /root/.bashrc: Permission denied
and trying it with sudo yields sudo: source: command not found
. retrying the original command at this point brings me back to point 0.– isapir
May 18 '14 at 18:05
@Igal: Edited my answer to solve that issue, you should first use
sudo -i
before you source
. Thanks for pointing that out.– jobin
May 18 '14 at 18:06
@Igal: Edited my answer to solve that issue, you should first use
sudo -i
before you source
. Thanks for pointing that out.– jobin
May 18 '14 at 18:06
ok, pardon the newbie questions, but how do I exit the
sudo -i
once I'vet called source? without exiting I am getting the original error message...– isapir
May 18 '14 at 18:08
ok, pardon the newbie questions, but how do I exit the
sudo -i
once I'vet called source? without exiting I am getting the original error message...– isapir
May 18 '14 at 18:08
@Igal: Just press Ctrl + d or type
exit
.– jobin
May 18 '14 at 18:09
@Igal: Just press Ctrl + d or type
exit
.– jobin
May 18 '14 at 18:09
|
show 8 more comments
The solution I was looking for is in /etc/environment
which, as specified at EnvironmentVariables, does not process scripts and does not expand variables, so adding the following (without export) did the trick:
JAVA_HOME=/opt/java/jdk1.8.0_05
Then I rebooted the system for the changes to take affect.
add a comment |
The solution I was looking for is in /etc/environment
which, as specified at EnvironmentVariables, does not process scripts and does not expand variables, so adding the following (without export) did the trick:
JAVA_HOME=/opt/java/jdk1.8.0_05
Then I rebooted the system for the changes to take affect.
add a comment |
The solution I was looking for is in /etc/environment
which, as specified at EnvironmentVariables, does not process scripts and does not expand variables, so adding the following (without export) did the trick:
JAVA_HOME=/opt/java/jdk1.8.0_05
Then I rebooted the system for the changes to take affect.
The solution I was looking for is in /etc/environment
which, as specified at EnvironmentVariables, does not process scripts and does not expand variables, so adding the following (without export) did the trick:
JAVA_HOME=/opt/java/jdk1.8.0_05
Then I rebooted the system for the changes to take affect.
answered May 18 '14 at 22:59
isapirisapir
183129
183129
add a comment |
add a comment |
I added JAVA_HOME in tomcat7.service
script as setenv.sh
was not get sourced by catalina.sh
Steps:
1.Open tomcat7 service script file
sudo gedit /etc/init.d/tomcat7
2.Set JAVA_HOME
.
.
.
JAVA_HOME=/usr/lib/jvm/java-8-oracle
# Directory where the Tomcat 6 binary distribution resides
CATALINA_HOME=/usr/share/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
# Use the Java security manager? (yes/no)
TOMCAT7_SECURITY=no
3.Start tomcat7 service
sudo service tomcat7 status
New contributor
add a comment |
I added JAVA_HOME in tomcat7.service
script as setenv.sh
was not get sourced by catalina.sh
Steps:
1.Open tomcat7 service script file
sudo gedit /etc/init.d/tomcat7
2.Set JAVA_HOME
.
.
.
JAVA_HOME=/usr/lib/jvm/java-8-oracle
# Directory where the Tomcat 6 binary distribution resides
CATALINA_HOME=/usr/share/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
# Use the Java security manager? (yes/no)
TOMCAT7_SECURITY=no
3.Start tomcat7 service
sudo service tomcat7 status
New contributor
add a comment |
I added JAVA_HOME in tomcat7.service
script as setenv.sh
was not get sourced by catalina.sh
Steps:
1.Open tomcat7 service script file
sudo gedit /etc/init.d/tomcat7
2.Set JAVA_HOME
.
.
.
JAVA_HOME=/usr/lib/jvm/java-8-oracle
# Directory where the Tomcat 6 binary distribution resides
CATALINA_HOME=/usr/share/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
# Use the Java security manager? (yes/no)
TOMCAT7_SECURITY=no
3.Start tomcat7 service
sudo service tomcat7 status
New contributor
I added JAVA_HOME in tomcat7.service
script as setenv.sh
was not get sourced by catalina.sh
Steps:
1.Open tomcat7 service script file
sudo gedit /etc/init.d/tomcat7
2.Set JAVA_HOME
.
.
.
JAVA_HOME=/usr/lib/jvm/java-8-oracle
# Directory where the Tomcat 6 binary distribution resides
CATALINA_HOME=/usr/share/$NAME
# Directory for per-instance configuration files and webapps
CATALINA_BASE=/var/lib/$NAME
# Use the Java security manager? (yes/no)
TOMCAT7_SECURITY=no
3.Start tomcat7 service
sudo service tomcat7 status
New contributor
New contributor
answered 10 mins ago
CᴴᴀZCᴴᴀZ
11
11
New contributor
New contributor
add a comment |
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f468772%2ftomcat-does-not-recognize-java-home%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown