We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

What is my non-programmatic alternative to setting System properties instead of using -D to set them?

TomBruser
TomBruser asked
on
Medium Priority
228 Views
Last Modified: 2013-12-02
I know that you can specify system properties to be used by Java by specifying -Dmy.property.name=myvalue in the command-line, but is there a way to specify a .properties file to read these properties in from VIA THE COMMANDLINE without altering my code?

What I'm trying to do:
I'm trying to install various instances of Tomcat, but I want to be able to specify in separate .properties file some of the variables to be set in the server.xml.  I've been successful in doing this with -D, i.e. -Dtomcat.http.port=8082 and then in my server.xml replacing the port # with ${tomcat.http.port}.  This would seem to be more maintainable if I could just keep a digest of all of the properties in one file that I could point to instead of altering my startup scripts.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2016

Commented:
What OS do you run on?
CERTIFIED EXPERT
Top Expert 2016

Commented:
Starting with Ant is a good way, whatever OS you use

Author

Commented:
It may be either Windows or AIX depending on if it's development, testing, QA, etc.  What would be the ant approach?
CERTIFIED EXPERT
Top Expert 2016
Commented:
See

http://ant.apache.org/manual/CoreTasks/java.html

look at the examples with jvmarg elements - that's what you need

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Top Expert 2016

Commented:
:-)
Mick BarryJava Developer
CERTIFIED EXPERT
Top Expert 2010

Commented:
Starting with ant's going to be a maintenance nightmare, trust me :)

Author

Commented:
Sorry that points have already been awarded since it is technically a valid solution that CEHJ provided, but what would you suggest as an alternative?  I'm not a big ant fan either - but I use it when necessary.
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.