在Linux上部署Java项目过程

07-16 1002阅读

文章目录

  • 1、ps -ef | grep java
  • 2、杀死指定的.jar程序
  • 3、此时再查看java进程
  • 4、找到.jar包在linux上存储的位置
  • 5、切换到存放.jar目录
  • 5、把相应的.jar包放入这个目录
  • 6、启动指定的java程序

    1、ps -ef | grep java

    [root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
    root      192107       1  1 May22 ?        20:38:41 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
    root      220703       1  0 May22 ?        05:11:06 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
    root      252545       1  0 May22 ?        03:31:45 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
    root     1401323       1  0 Jul11 ?        00:07:10 java -jar bailian-service-main-1.0.0-SNAPSHOT.jar
    root     2692454 2542595  0 16:04 pts/0    00:00:00 grep --color=auto java
    

    2、杀死指定的.jar程序

    [root@iZuf6332h890vozldoxcprZ bailian]# kill 1401323
    [root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
    root      192107       1  1 May22 ?        20:38:44 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
    root      220703       1  0 May22 ?        05:11:07 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
    root      252545       1  0 May22 ?        03:31:46 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
    root     2698202 2542595  0 16:07 pts/0    00:00:00 grep --color=auto java
    

    3、此时再查看java进程

    [root@iZuf6332h890vozldoxcprZ bailian]# ps -ef | grep java
    root      192107       1  1 May22 ?        20:39:00 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/bin/java -Xms512m -Xmx512m -Xmn256m -Dnacos.standalone=true -Dnacos.member.list= -Djava.ext.dirs=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/jre/lib/ext:/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.342.b07-1.el9_0.x86_64/lib/ext -Xloggc:/bailian/nacos/logs/nacos_gc.log -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintGCTimeStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=100M -Dloader.path=/bailian/nacos/plugins/health,/bailian/nacos/plugins/cmdb -Dnacos.home=/bailian/nacos -jar /bailian/nacos/target/nacos-server.jar --spring.config.additional-location=file:/bailian/nacos/conf/ --logging.config=/bailian/nacos/conf/nacos-logback.xml --server.max-http-header-size=524288 nacos.nacos
    root      220703       1  0 May22 ?        05:11:13 java -jar bailian-service-base-1.0.0-SNAPSHOT.jar
    root      252545       1  0 May22 ?        03:31:50 java -jar bailian-service-app-1.0.0-SNAPSHOT.jar
    root     2744062 2542595  0 16:31 pts/0    00:00:00 grep --color=auto java
    

    4、找到.jar包在linux上存储的位置

    [root@iZuf6332h890vozldoxcprZ ~]# find / -name *.jar
    /bailian/bailian-service-base-1.0.0-SNAPSHOT.jar
    /bailian/bailian-service-app-1.0.0-SNAPSHOT.jar
    /bailian/bak/bailian-service-main-1.0.0-SNAPSHOT.jar
    /bailian/bailian-service-main-1.0.0-SNAPSHOT.jar
    

    5、切换到存放.jar目录

    [root@iZuf6332h890vozldoxcprZ ~]# cd /bailian/
    [root@iZuf6332h890vozldoxcprZ bailian]# ll
    total 1626640
    -rw-r--r-- 1 root root      29471 May 20 15:50 333.txt
    -rw-r--r-- 1 root root  111911562 Aug 24  2023 bailian-service-app-1.0.0-SNAPSHOT.jar
    -rw-r--r-- 1 root root  108757893 Aug 15  2023 bailian-service-base-1.0.0-SNAPSHOT.jar
    -rw-r--r-- 1 root root  117371177 Jul 11 15:24 bailian-service-main-1.0.0-SNAPSHOT.jar
    drwxr-xr-x 2 root root        104 Jul 11 15:23 bak
    drwxr-xr-x 3 root root         18 Aug 14  2023 bat
    drwxr-xr-x 7 root root         96 Aug  9  2022 nacos
    -rw------- 1 root root 1327590305 Jul 12 16:07 nohup.out
    drwxr-xr-x 3 root root        114 May 22  2023 template
    

    5、把相应的.jar包放入这个目录

    在Linux上部署Java项目过程

    6、启动指定的java程序

    [root@iZuf6332h890vozldoxcprZ bailian]# nohup java -jar bailian-service-main-1.0.0-SNAPSHOT.jar &
    [1] 2749319
    [root@iZuf6332h890vozldoxcprZ bailian]# nohup: ignoring input and appending output to 'nohup.out'
    
VPS购买请点击我

文章版权声明:除非注明,否则均为主机测评原创文章,转载或复制请以超链接形式并注明出处。

目录[+]