Java path set in linux [closed]

2019-09-21 08:22发布

am able to set java path in linux environment as shown in the below image but when i close and again opening the putty environment..then again java path is not set ...so each and every time when i open putty i have to set java path...so how can i able to set it permanently...

[root@ip-177-31-21-182 /]# export JAVA_HOME=//opt/jdk1.7.0_55
[root@ip-177-31-21-182 /]# export JAVA_HOME=/opt/jdk1.7.0_55
[root@ip-177-31-21-182 /]# export JAVA_HOME=/opt/jdk1.7.0_55/jre
[root@ip-177-31-21-182 /]# export PATH=$PATH:/opt/jdk1.7.0_55/bin:/opt/jdk1.7.0_55/jre/bin
[root@ip-177-31-21-182 /]# which javac
/opt/jdk1.7.0_55/bin/javac
[root@ip-177-31-21-182 /]# ^C
[root@ip-177-31-21-182 /]#

标签: linux
1条回答
smile是对你的礼貌
2楼-- · 2019-09-21 08:47
export JAVA_HOME=/opt/jdk1.7.0_55

Will only set JAVA_HOME as environment variable for current session. If you want your changes to be persistent, you need to set this in your user accounts .bash_profile file located exactly at ~/.bash_profile

This will make bash to set JAVA_HOME as environment variable every time this user logs into the system.

查看更多
登录 后发表回答