Linux下設定TOMCAT環境變數的三種方法__Linux

來源:互聯網
上載者:User

在linux下啟動veridata後,一直不能使用WEB進行訪問。猜測可能是因為linux下的TOMCAT環境變數設定不正確導致,因此修改tomcat環境變數,問題解決。


注意:JAVA_HOME是安裝JDK的目錄;多個變數值之間使用;進行分割;CLASSPATH的值不能丟掉表示目前的目錄的.;export表示把變數匯出為全域變數;大小寫必須嚴格區分。

1、直接編輯profile檔案

該方法是修改全域變數,因此對所有使用SHELL下JAVA環境變數的使用者都有許可權,但是可能會給系統帶來安全性問題。操作如下:

[root@ora-rac2 ~]# vi /etc/profile

export JAVA_HOME=/cdr/jdk1.7.0_51
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar:$CLASSPATH
export CATALINA_HOME=/u01/ggs/veridata/web
export CATALINA_BASE=/u01/ggs/veridata/web

儲存後,退出

[root@ora-rac2 ~]# source /etc/profile

關閉當前串連的會話,即可生效。


2、修改.bash_profile檔案

該方法將是修改使用者環境變數,因此使用環境變數的許可權控制在使用者層級,即使用su到不同使用者後設定的環境變數只對目前使用者有效,所以該方法更加安全。操作如下:

[root@centos-1 ~]# su - oracle
[oracle@centos-1 ~]$ pwd
/home/oracle
[oracle@centos-1 ~]$ vi .bash_profile

export CATALINA_HOME=/u01/ggs/veridata/web
export CATALINA_BASE=/u01/ggs/veridata/web

儲存後,退出,即可生效。

3、直接在shell終端執行命令即可設定變數

該方法只是臨時使用,即如果換了shell則當前設定的變數值不會生效,因此不贊成使用該方法。操作如下:

[root@ora-rac2 ~]# export CATALINA_HOME=/u01/ggs/veridata/web1
[root@ora-rac2 ~]# export CATALINA_BASE=/u01/ggs/veridata/web1
[root@ora-rac2 ~]# 
[root@ora-rac2 ~]# echo $CATALINA_HOME
/u01/ggs/veridata/web1
[root@ora-rac2 ~]# echo $CATALINA_BASE
/u01/ggs/veridata/web1
[root@ora-rac2 ~]# 



聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.