This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Env. Sys. variables. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Env. Sys. variables." Watch "Env. Sys. variables." New topic

Env. Sys. variables.

Tonny Tssagovic
Ranch Hand

Joined: Dec 30, 2003
Posts: 226
Hello people,
I have an API (to which no real doc/code exists) and I made a simple standalone application that works fine. Now I want to make this feature available via a servlet.
To run the simple app, I use a .bat file provided by the API, which passes some sys variables (I don't have clue what they are) when running java: For example java -Dblahblah=blahblah -Dfoo=foo my appp %1%2-...
How can I pass these to my servlet? I am just using

For before each call to the function that uses the Api (which iself needs these variables)
But it does not seem to work!
Is this the way to go ?ideas?
ANd another important think is that some of these params are some proprieties files that are needed by the API, where should I place these files to be accessible to tomcat, when it calls a function of these APIs? Under lib, or anything in the classpath will do ??
Any help will be very much appreciated!
[ February 29, 2004: Message edited by: Tonny Tssagovic ]
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 12769
A good place for properties files is under WEB-INF - that way you can get at them without any disk path information and they can't be accidently exposed. See ServletContext getResourceAsStream()
I agree. Here's the link:
subject: Env. Sys. variables.