请参考:这篇博客
第二步:上传jar包到Linux上在这里我使用SecureCRT进行上传
当CRT连接上Centos后,按alt+P进入上传页面,并将本地jar包上传,本地jar包位置与上传截图如下:
查看jar包,并将jar包放入testjar目录中
[root@localhost etc]# cd ~ [root@localhost ~]# ls anaconda-ks.cfg docker-files kafka 模板 文档 桌面 apisix helloCrontab-1.0-SNAPSHOT.jar test_centos.tar 视频 下载 data initial-setup-ks.cfg 公共 图片 音乐 [root@localhost ~]# mkdir testjar [root@localhost ~]# mv helloCrontab-1.0-SNAPSHOT.jar ./testjar/ [root@localhost ~]# ls anaconda-ks.cfg data initial-setup-ks.cfg test_centos.tar 公共 视频 文档 音乐 apisix docker-files kafka testjar 模板 图片 下载 桌面 [root@localhost ~]# cd testjar/ [root@localhost testjar]# ls helloCrontab-1.0-SNAPSHOT.jar [root@localhost testjar]#第三步:运行jar包
[root@localhost testjar]# ls helloCrontab-1.0-SNAPSHOT.jar [root@localhost testjar]# nohup java -jar helloCrontab-1.0-SNAPSHOT.jar nohup: 忽略输入并把输出追加到"nohup.out" [root@localhost testjar]#
报错!!
报错解决(nohup: 忽略输入并把输出追加到"nohup.out")# 创建日志收集的文件 [root@localhost testjar]# touch crontabstest.log # 将上面的执行命令换成下面的命令,便不报错了 [root@localhost testjar]# nohup java -jar helloCrontab-1.0-SNAPSHOT.jar >> crontabstest.log 2>&1 [root@localhost testjar]# nohup java -jar helloCrontab-1.0-SNAPSHOT.jar >> crontabstest.log 2>&1 [root@localhost testjar]# cat crontabstest.log nohup: 忽略输入 helloCrontab [root@localhost testjar]# nohup java -jar helloCrontab-1.0-SNAPSHOT.jar >> crontabstest.log 2>&1 [root@localhost testjar]# cat crontabstest.log nohup: 忽略输入 helloCrontab nohup: 忽略输入 helloCrontab [root@localhost testjar]#



