linux搭建开发环境
1、查看linux机器是32位还是64位的方法:
file /sbin/init 或者file /bin/ls
/bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=3d705971a4c4544545cb78fd890d27bf792af6d4, stripped
2、下载JDK压缩包:
http://download.oracle.com/otn-pub/java/jdk/8u151-b12/e758a0de34e24606bca991d704f6dcbf/jdk-8u151-linux-x64.tar.gz?AuthParam=1511957587_2faa3bdc86a4a8ab70d798d048317552
3、解压到/usr/java目录
tar -xzvf jdk-8u151-linux-x64.tar.gz
4、配置环境变量,编辑/etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_151
export JAVA_BIN=$JAVE_HOME/bin
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export JAVA_OPTS="-Djava.library.path=/usr/local/lib -server -Xms1024m -Xmx2048m -XX:MaxPermSize=256m -Djava.awt.headless=true -Dsun.net.client.defaultReadTimeout=60000 -Djmagick.systemclassloader=no -Dnetworkaddress.cache.ttl=300 -Dsun.net.inetaddr.ttl=300"
export JAVA_HOME JAVA_BIN PATH CLASSPATH JAVA_OPTS
export PATH=$PATH:/usr/erlang/bin
export APPHOME=$HOME/apphome
export M2_HOME=/usr/apache-maven-3.5.2
export PATH=$PATH:$M2_HOME/bin
export MYSQL_HOME=/home/mysql-5.6.37-linux-glibc2.12-x86_64
export PATH=$PATH:$MYSQL_HOME/bin
5、配置的JDK 生效
source /etc/profile
6、查看JDK是否安装成功 java -version
java version "1.8.0_151"
Java(TM) SE Runtime Environment (build 1.8.0_151-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)
7、查到应用进程,然后kill 脚本
kill $(ps -eaf | grep "/opt/jdk1.8/bin/java -jar /home/App/demo/demo.jar" | grep -v grep | awk '{print $2}')