Solved

How do I get windows environment variables?

Posted on 2003-11-20
6
3,408 Views
Last Modified: 2007-12-19
How do I get windows system environment variables in my .jsp file?

Thanks in advance
0
Comment
Question by:auduin
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 15

Accepted Solution

by:
jimmack earned 50 total points
ID: 9792321
AFAIK, there is no access to system environment variables from within an executing Java application.

Normally, I would say that you need to pass the value in from the command line:

java -Dvarname=value MyClass

In this case, the servlet container is effectively compiling and executing your JSP (convert to Servlet, compile, run), so I don't know if it's possible at all.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9792332
0
 
LVL 14

Expert Comment

by:kennethxu
ID: 9793238
jimmack is correct on this. If you mean you want to read server side env var, I used this in startup script

set >env.properties

and then use java.util.Properties to read the env.properties file. you get all your env var from there.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:auduin
ID: 9807216
Thought that was the case, was just making sure. Thank you all for your help.
0
 
LVL 15

Expert Comment

by:jimmack
ID: 9818341
;-)  No problem.
0

Featured Post

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you troubleshoot Outlook for clients, you may want to know a bit more about the OST file before doing your next job. IMAP can cause a lot of drama if removed in the accounts without backing up.
There is a lot to be said for protecting yourself and your accounts with 2 factor authentication.  I found to my own chagrin, that there is a big downside as well.
This video Micro Tutorial shows how to password-protect PDF files with free software. Many software products can do this, such as Adobe Acrobat (but not Adobe Reader), Nuance PaperPort, and Nuance Power PDF, but they are not free products. This vide…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…

734 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