Solved

java tomcat catalina.sh

Posted on 2006-06-21
11
1,329 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
[X]
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
  • 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
Raise the IQ of Your IT Alerts

From IT major incidents to manufacturing line slowdowns, every business process generates insights that need to reach the people required to take action. You need a platform that integrates with your business tools to create fully enabled DevOps toolchains.

You need xMatters.

 

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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

717 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