Solved

java tomcat catalina.sh

Posted on 2006-06-21
11
1,296 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:mayankeagle
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
 

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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 30

Expert Comment

by:mayankeagle
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
sumHeights2  challenge 7 76
@SBGen Method 3 25
Java and GPO 11 47
compre toata in where clue oracle 4 41
An old method to applying the Singleton pattern in your Java code is to check if a static instance, defined in the same class that needs to be instantiated once and only once, is null and then create a new instance; otherwise, the pre-existing insta…
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…

707 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now