Solved

How do I get windows environment variables?

Posted on 2003-11-20
6
3,405 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
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
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 6

Expert Comment

by:kotan
ID: 9795074
0
 

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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
trouble with PDF encryption using itext-1.3.1 17 84
EJB MDB example 4 83
struts exact match support 3 56
jdbc error in jsp application 20 44
SEO can be a real minefield to navigate, but there are three simple ways to up your SEO game just be re-assessing your content output.
Do you use a spreadsheet like Microsoft's Excel?  Have you ever wanted to link out to a non excel file on your computer or network drive?  This is the way I found to do it!
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

776 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