Linux RHEL 7.9 global environment vars

JulioAlblozano

New Member
Joined
Jun 2, 2021
Messages
4
Reaction score
0
Credits
31
I have a project with Jasperreports in a Redhat 7.9 linux environment and I need to use the function System.getenv("Var Name"), then I configure it in the bash_profile file, but when I use it it returns "null" , I have tried many things that they say in the forums, but nothing gives me result. I thank you for your help.

1622588832033.png

That way I configure them and I can see them, but in the report it always shows "null".

1622588970412.png
 


.bashrc and .bash_profile are usually just for individual users, not global.

I would put this in /etc/environment
 
Thanks, I did that too but it didn't work for me, I don't know what I'm doing wrong. It does not take the var
 
Thanks, I did that too but it didn't work for me, I don't know what I'm doing wrong. It does not take the var

Are you "sourcing" the file after you edit it? (You may have to reboot)

What happens if you ...
echo $LABVANTAGE_HOMEICP
 
Generates the following

1622641641186.png


This is the environment file

1622641726340.png


and I have already restarted the system
 
It seems like, as far as the system in concerned, it's working.
Is this a python application? Is it in a virtual env?
 
No, it is Java a web portal with Jboss, the call of the variable is done with System.getenv("LABVANTAGE_HOMEICP"), with Linux machine on Azure Cloud
 
It's my understanding Java doesn't support global variables from the system.
You could have a global class, but you would still have to define them in code
or a config file for your app. (But then it wouldn't be global)
 

Members online


Latest posts

Top