1. jdk配置
- jdk下载地址(JDK1.8):http://www.oracle.com/technetwork/cn/java/javase/downloads/jdk8-downloads-2133151-zhs.html
Snipaste_2018-09-10_19-26-18.jpg
将下载好的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环境变量
修改当前用户的环境变量
vim ~/.bashrc
Snipaste_2018-09-10_19-40-16.jpg
在文件末尾添加如下内容
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
Snipaste_2018-09-10_19-41-58.jpg
-
将下载好的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启动脚本
sudo vim /opt/java/tomcat-7/bin/startup.sh
Snipaste_2018-09-10_19-48-38.jpg
在文件末尾,exec "$PRGDIR"/"EXECUTABLE" start "$@"
之上添加如下内容
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
- 测试是否能够运行tomcat
在终端中输入
sudo ./bin/startup.sh
启动成功如下
Snipaste_2018-09-10_19-51-04.jpg
在浏览器中输入localhost:8080
Snipaste_2018-09-10_19-52-08.jpg- 停止tomcat
修改shutdown.sh
sudo vim /opt/java/tomcat-7/bin/shutdown.sh
在文件末尾,exec "$PRGDIR"/"EXECUTABLE" start "$@"
之上添加如下内容
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/
下 - 运行
/opt/eclipse/eclipse
启动eclipse
Snipaste_2018-09-10_20-10-19.jpg
网友评论