Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

java tomcat catalina.sh

Posted on 2006-06-21
11
1,309 Views
Last Modified: 2013-11-24
Hi
In my application there are some resource files in /root/resources directory
there is an entry in tomcat,s(On Linux) catalina.sh file which is :
          CATALINA_OPTS="-bhel.resources.dir=/root/resources"

and in one of the java class  this line is written
    String sResourcesDir = System.getProperty("bhel.resources.dir");

i need to know what is this and why we are using this(and what is the need to read this property from catalina.sh normally if we can do this from other way)

if i put these resource files in c:\resources on windows platform
than what entry shuold i put in (cataline.bat/catalina.sh ?) equalant to linux platform so that my application can read
resource files without any problem
thanks
0
Comment
Question by:riteinfotech
  • 4
  • 4
  • 2
  • +1
11 Comments
 
LVL 30

Expert Comment

by:Mayank S
ID: 16952098
Not sure about Windows, but perhaps: CATALINA_OPTS="-bhel.resources.dir=C:/resources"
0
 
LVL 86

Expert Comment

by:CEHJ
ID: 16952296
>>CATALINA_OPTS="-bhel.resources.dir=/root/resources"

is a VM argument. Given the way you are accessing it, it should probably be

CATALINA_OPTS="bhel.resources.dir=/root/resources"

A better way to do this would be in your context:

http://tomcat.apache.org/tomcat-4.1-doc/config/defaultcontext.html



0
 
LVL 92

Expert Comment

by:objects
ID: 16956230
The catalina_opts env var is passed on the command line used to startup tomcat
It appears to be beiung used to specify the location of a directory

try

    CATALINA_OPTS="-bhel.resources.dir=/resources"

exactly what to use depends a little on how he value actually gets used
0
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 

Author Comment

by:riteinfotech
ID: 16960183
what do we mean by this

          System.getProperty("bhel.resources.dir");
 in an application System denotes to what(here System indicates catalina.sh ? )
????????
thanks
0
 
LVL 92

Expert Comment

by:objects
ID: 16964664
System is a Java class

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html

getProperty() is a static member in that class to return the value of a system property

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/System.html#getProperty(java.lang.String)

0
 
LVL 30

Expert Comment

by:Mayank S
ID: 16966596
0
 

Author Comment

by:riteinfotech
ID: 16968043
my question is  how system identify(came to know) that "bhel.resources.dir" property is defined in tomcat's catalina.sh file ?????????????
0
 
LVL 92

Expert Comment

by:objects
ID: 16968157
because the value of CATALINA_OPTS is passed as aparameter when tomcat is started

  "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
    -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
    -Dcatalina.base="$CATALINA_BASE" \
    -Dcatalina.home="$CATALINA_HOME" \
    -Djava.io.tmpdir="$CATALINA_TMPDIR" \
    org.apache.catalina.startup.Bootstrap "$@" stop
0
 

Author Comment

by:riteinfotech
ID: 16968189
can u pls explain this all in details, plsssssssssssssssssss !
0
 

Author Comment

by:riteinfotech
ID: 16968439
i mean why CATALINA_OPTS is used for?
why tomcat need this?

and this too ------>
                 
            because the value of CATALINA_OPTS is passed as aparameter when tomcat is started

                "$_RUNJAVA" $JAVA_OPTS $CATALINA_OPTS \
                -Djava.endorsed.dirs="$JAVA_ENDORSED_DIRS" -classpath "$CLASSPATH" \
                -Dcatalina.base="$CATALINA_BASE" \
                -Dcatalina.home="$CATALINA_HOME" \
                -Djava.io.tmpdir="$CATALINA_TMPDIR" \
                org.apache.catalina.startup.Bootstrap "$@" stop


      Thanks
0
 
LVL 92

Accepted Solution

by:
objects earned 250 total points
ID: 16973592
CATALINA_OPTS is used for passing command line arguments for tomcat.
tomcat does not need it it is there to allow you to pass additional site specific args when starting up toimcat.
Its actually there so you do *not* have to change catalina.sh to pass extra args allowing you to instead specify them in your environment variables.  in your case assign site specific environment variable.

> and this too ------>

thats the command run to start tomcat, note it inclused the value of the CATALINA_OPTS environemnebt variable
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
eclipse apache tomcat admin console 52 121
Java exception bubble up 2 21
null output 3 35
Need help aligning JRadioButton that put in a box using GridBagLayout 2 17
INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question