Getting the value of an environment variable in java?

I set the environment variable in windows named "sample". Can I get this environment variable value using the code below?

System.getProperty("sample");

in a UAT environment I have a LINUX OS. Can I set the same environment variable in LINUX and get it with System.getProperty("sample")?

I mean, what System.getProperty("sample");is retrieved regardless of the operating system?

Also, I would like to get the value of the environment variable in JSP. I know that it is not recommended to save the logic in jsp, but still I need to use it. Can i use System.getProperty("sample");in jsp? Please help me.

0
source share
2 answers

, , JSP.

+1

System.getenv() , System.getProperty(). ( ) .

? Java


JSP, - . , . More reading: Java- JSP ?

+12

Source: https://habr.com/ru/post/1540913/


All Articles