1. jdk配置
- jdk下載地址(JDK1.8):http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html
將下載好的jdk解壓到/opt/java/
下,并改名為jdk1.8
sudo mkdir /opt/java
sudo tar -zxvf jdk-8u181-linux-x64.tar.gz -C /opt/java
sudo mv /opt/java/jdk1.8.0_181 /opt/java/jdk1.8
- 配置java環(huán)境變量
修改當(dāng)前用戶的環(huán)境變量
vim ~/.bashrc
在文件末尾添加如下內(nèi)容
export JAVA_HOME=/opt/java/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
保持退出,在終端中輸入java -version
查看是否配置成功
2. tomcat安裝配置
-
tomcat下載地址(tomcat 7):https://tomcat.apache.org/download-70.cgi
將下載好的tomcat 7解壓到
/opt/java/tomcat-7/
sudo tar -zxvf apache-tomcat-7.0.90.tar.gz -C /opt/java/
sudo mv /opt/java/apache-tomcat-7.0.90 /opt/java/tomcat
- 配置tomcat
修改tomcat啟動(dòng)腳本
sudo vim /opt/java/tomcat-7/bin/startup.sh
在文件末尾,exec "$PRGDIR"/"EXECUTABLE" start "$@"
之上添加如下內(nèi)容
export JAVA_HOME=/opt/java/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
export TOMCAT_HOME=/opt/java/tomcat-7
- 測(cè)試是否能夠運(yùn)行tomcat
在終端中輸入
sudo ./bin/startup.sh
啟動(dòng)成功如下
在瀏覽器中輸入localhost:8080
- 停止tomcat
修改shutdown.sh
sudo vim /opt/java/tomcat-7/bin/shutdown.sh
在文件末尾,exec "$PRGDIR"/"EXECUTABLE" start "$@"
之上添加如下內(nèi)容
export JAVA_HOME=/opt/java/jdk1.8
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
export TOMCAT_HOME=/opt/java/tomcat-7
3. eclipse安裝配置
- eclipse下載地址http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/neon/1a/eclipse-jee-neon-1a-linux-gtk-x86_64.tar.gz
- 將eclipse解壓到
/opt/
下 - 運(yùn)行
/opt/eclipse/eclipse
啟動(dòng)eclipse