how to pass command line arguments to Jetty

I am starting jetty like : service jetty start
This links to the file...
Now in my java code i have the following lines :

<bean id="placeholderConfig" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location">

Open in new window

If i make an environment variable with name FLOCK_APPS_CONFIG it works.
But i dont want to make an environment variable. I want to use another approach
in which some way i pass this parameter while starting jetty.
How can i do this ?

Rohit BajajAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Why not then something like this?

export FLOCK_APPS_CONFIG=foo;service jetty start

Open in new window

Rohit BajajAuthor Commented:
i will be running the service from a headless user in linux. it wont have any environment variablea no bash profile. so i guesa i cannot do that
Rohit BajajAuthor Commented:
i can have the parameter also in a file. but the problem is how does spring pick it up at runtime. as based on this parameter i will pick up correct configuration file.
The 7 Worst Nightmares of a Sysadmin

Fear not! To defend your business’ IT systems we’re going to shine a light on the seven most sinister terrors that haunt sysadmins. That way you can be sure there’s nothing in your stack waiting to go bump in the night.

it wont have any environment variablea no bash profile. so i guesa i cannot do that
You (almost certainly) guess wrong
Rohit BajajAuthor Commented:
That didnt work even for a normal user i tried : export FLOCK_APPS_CONFIG=staging;service jetty start
But i got the following error in jetty logs :
IllegalArgumentException: Could not resolve placeholder `FLOCK_APPS_CONFIG` in string value "classpath:properties/${FLOCK_APPS_CONFIG}/
Rohit BajajAuthor Commented:
For the normal user also it works only when i put export FLOCK_APPS_CONFIG=staging in ~/.bash_profile
As what user is jetty running?
Rohit BajajAuthor Commented:
i am logged in as root.its running as root only
Rohit BajajAuthor Commented:
i have read about parameters passing with -D option. dont know much but if there is some way to pass it inside script file which is inside of bin ...probably things will work
It's NOT a good idea to run it as root. This reference looks sensible, though with user 'jetty' deliberately not having a shell, you will have to put the variable somehow in a script

Of course there's a difference between an environment variable and a -D jvm property, but your original code could possibly work with the latter

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.