File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes setting java_opts with value in it Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "setting java_opts with value in it" Watch "setting java_opts with value in it" New topic
Author

setting java_opts with value in it

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
Hi,
I am trying to set java_opts having values with spaces in catalina.sh. I am trying this in unix. Can, somebody tell how we set java_opts with spaces in catalina.sh. I tried below and it doesn't work.
JAVA_OPTS="$JAVA_OPTS "-DargumentA=0 0 12 * * ?""
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16012
    
  19

The best way to set Java/JVM options is to create a bin/setenv.sh or bin\setenv.bat file (depending on which OS you're using) and put the statement in that file. That way you don't have to modify the factory-supplied scripts.

You should, I believe, actually be able to simple make the setenv.sh contents look like this:



I don't believe that Tomcat has any existing JAVA_OPTS values to worry about.

However, I should caution you that it is NOT a good idea to pass configuration information into webapps via the JVM environment.

From the looks of it, you are attempting to set a cron-style schedule (probably for Quartz Scheduler) and make it externally customizable. I'd recommend doing this with an Environment sub-element in the webapp's Context definition. It's what I always do.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: setting java_opts with value in it