Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tomcat 7 setenv.sh is not found

I downloaded and extracted the apache-tomcat-7.0. As per the instructions in the RUNNING.txt (%CATALINA_BASE%/RUNNING.txt), it should set the JRE_HOME in the "setenv.sh" file.

Where is this file located ? Documentation said, it would be in CATALINA_HOME/bin directory. However this file is not present there.

like image 482
Prakash Raman Avatar asked Feb 28 '12 10:02

Prakash Raman


People also ask

Where is Tomcat Setenv sh?

Apart from CATALINA_HOME and CATALINA_BASE, all environment variables can be specified in the "setenv" script. The script is placed either into CATALINA_BASE/bin or into CATALINA_HOME/bin directory and is named setenv.

What is Setenv SH in Tomcat?

The setenv. batcommand is used to modify or to set environment variables for the Tomcat application server. These setting only apply when using the catalina.

Where is Catalina SH Tomcat 9?

CATALINA_HOME is the folder where Apache Tomcat is installed e.g. c:\program files\Apache Tomcat or /usr/apache/tomcat . It is the folder where you unzip Tomcat in the first place (when you install from zip).


3 Answers

Documentation does mention about the absence of setenv.(sh|bat) file:

(3.4) Using the "setenv" script (optional, recommended)

Apart from CATALINA_HOME and CATALINA_BASE, all environment variables can
be specified in the "setenv" script. The script is placed either into
CATALINA_BASE/bin or into CATALINA_HOME/bin directory and is named
setenv.bat (on Windows) or setenv.sh (on *nix). The file has to be
readable.

    By default the setenv script file is absent. If the script file is present
    both in CATALINA_BASE and in CATALINA_HOME, the one in CATALINA_BASE is
    preferred

    For example, to configure the JRE_HOME and CATALINA_PID variables you can
    create the following script file:

On Windows, %CATALINA_BASE%\bin\setenv.bat:

  set "JRE_HOME=%ProgramFiles%\Java\jre6"
  exit /b 0


On *nix, $CATALINA_BASE/bin/setenv.sh:

  JRE_HOME=/usr/java/latest
  CATALINA_PID="$CATALINA_BASE/tomcat.pid"

http://tomcat.apache.org/tomcat-7.0-doc/RUNNING.txt

like image 64
Technext Avatar answered Oct 22 '22 13:10

Technext


If you don't find the "setenv.sh" or "setenv.bat" in bin folder of tomcat, follow the following setps:

  1. Create new file in bin folder of tomcat.
  2. Rename it to setenv.sh for linux user or setenv.bat for windows user
  3. Now you can set multiple thing into this file:

Setting JRE_HOME

For linux user

JRE_HOME=/path/to/jre/jre6

For Windows user

set JAVA_HOME=C:\Path\to\jre\jdk6

Setting JAVA_OPTS

For linux user

JAVA_OPTS="$JAVA_OPTS -Xms512m -Xmx512m -DFOOBAR_CONFIGURATION_FILE=file:///C:/foobar.properties"

For windows user

set "JAVA_OPTS=%JAVA_OPTS% -Xms512m -Xmx512m -DFOOBAR_CONFIGURATION_FILE=file:///D:\foobar.properties"

Restart tomcat after setting variables. That's it.

like image 20
SUDARSHAN BHALERAO Avatar answered Oct 22 '22 12:10

SUDARSHAN BHALERAO


Just create one yourself; it isn't part of the distribution. It's not that hard. For your case, simply add

JRE_HOME=/path/to/your/java/installation

to the file and make it executable (chmod 755 setenv.sh).

You can also add other options (e.g. -Xmx) if necessary.

like image 20
mindas Avatar answered Oct 22 '22 13:10

mindas