Linux下Java、Maven、Tomcat的安裝,maventomcat

來源:互聯網
上載者:User

Linux下Java、Maven、Tomcat的安裝,maventomcat

1、安裝Java(此處假定安裝目錄位/usr/local)

1)下載jdk(jdk-7),如下:

32位:http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-i586.tar.gz

64位:http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz

下載命令(以64位為例):

$ cd /usr/local$ sudo wget http://download.oracle.com/otn-pub/java/jdk/7u67-b01/jdk-7u67-linux-x64.tar.gz

2)解壓到安裝目錄,使用如下命令:

$ cd /usr/local$ sudo tar -xf jdk-7u67-linux-x64.tar.gz
3)配置環境變數,修改/etc/profile檔案

$ sudo vim /etc/profile
在末尾添加如下內容:

export JAVA_HOME=/usr/lib/jdk1.7.0_67  export JRE_HOME=/usr/lib/jdk1.7.0_67 /jre  export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
執行如下命令:

$ source /etc/profile
輸入java命令,看看是否生效,部分結果如下:

$ javaUsage: java [-options] class [args...]           (to execute a class)   or  java [-options] -jar jarfile [args...]           (to execute a jar file)where options include:    -d32          use a 32-bit data model if available    -d64          use a 64-bit data model if available    -server  to select the "server" VM                  The default VM is server.                      -cp <class search path of directories and zip/jar files>    -classpath <class search path of directories and zip/jar files>                  A : separated list of directories, JAR archives,                  and ZIP archives to search for class files.    -D<name>=<value>

2、安裝maven

1)下載,下載命令如下:

$ cd /usr/local$ sudo wget http://apache.fayea.com/apache-mirror/maven/maven-3/3.2.2/binaries/apache-maven-3.2.2-bin.tar.gz
2)解壓,命令如下:

$ cd /usr/local$ sudo tar -xf apache-maven-3.2.2-bin.tar.gz
3)配置環境變數

$ sudo vim /etc/profile
在末尾添加如下內容:

export M2_HOME=/usr/local/apache-maven-3.2.2export PATH=$PATH:$M2_HOME/bin

執行如下命令:

$ source /etc/profile
輸入mvn --help命令,看看是否生效,部分結果如下:

mvn --helpusage: mvn [options] [<goal(s)>] [<phase(s)>]Options: -am,--also-make                        If project list is specified, also                                        build projects required by the                                        list -amd,--also-make-dependents            If project list is specified, also                                        build projects that depend on                                        projects on the list -B,--batch-mode                        Run in non-interactive (batch)                                        mode -C,--strict-checksums                  Fail the build if checksums don't                                        match
3、安裝tomcat

1)下載

$ cd /usr/local$ sudo wget http://mirrors.cnnic.cn/apache/tomcat/tomcat-7/v7.0.55/bin/apache-tomcat-7.0.55.tar.gz
2)解壓縮

$ cd /usr/local$ sudo tar -xf apache-tomcat-7.0.55.tar.gz

3)配置環境變數

$ sudo vim /etc/profile
在末尾添加如下內容:

export export TOMCAT_HOME=/export/software/apache-tomcat-7.0.42export PATH=$PATH:$TOMCAT_HOME/bin
執行如下命令:

$ cd /usr/local/apache-tomcat-7.0.55$ bin/startup.shUsing CATALINA_BASE:   /usr/local/apache-tomcat-7.0.55Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.55Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.55/tempUsing JRE_HOME:        /usr/local/jdk1.7.0_67/jreUsing CLASSPATH:       /usr/local/apache-tomcat-7.0.55/bin/bootstrap.jar:/export/software/apache-tomcat-7.0.55/bin/tomcat-juli.jarTomcat started.
此時,在瀏覽器開啟http://localhost:8080,可以看到如下頁面,表示啟動成功。


可以執行如下命令關閉tomcat:

$ cd /usr/local/apache-tomcat-7.0.55$ bin/shutdown.shUsing CATALINA_BASE:   /usr/local/apache-tomcat-7.0.55Using CATALINA_HOME:   /usr/local/apache-tomcat-7.0.55Using CATALINA_TMPDIR: /usr/local/apache-tomcat-7.0.55/tempUsing JRE_HOME:        /usr/local/jdk1.7.0_67/jreUsing CLASSPATH:       /usr/local/apache-tomcat-7.0.55/bin/bootstrap.jar:/export/software/apache-tomcat-7.0.55/bin/tomcat-juli.jar

轉載請註明出處:http://blog.csdn.net/iAm333


Linux Java為何要安裝Tomcat

tomcat 是一個web容器,如果要得供web服務,就要安裝,當然也可安裝其它的,如果不打算提供web服務,可以不裝
 
JAVA中 maven+tomcat+eclipse開發環境run as maven build 中的Goals tomcat:run啟動一個外部的tomcat

你可以試試修改tomcat的startup,bat檔案 添加一行命令直接調用指定的tomcat
 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.