Running the jar file on a Linux cloud server

Source: Internet
Author: User

The usual way to run a jar file on a Linux server is to:

  $ Java-jar Test.jar
    • The feature is that when the SSH window is closed, the program aborts. or the runtime can't cut out to perform other tasks, is there a way to get the jar running in the background:
    • Method One:
$ nohup Java-jar Test.jar &

nohup 意思是不挂断运行命令,当账户退出或终端关闭时,程序仍然运行 //当用 nohup 命令执行作业时,缺省情况下该作业的所有输出被重定向到nohup.out的文件中 

除非另外指定了输出文件。
    • Method Two:
 $ nohup java -jar test.jar >temp.txt &  这种方法会把日志文件输入到你指定的文件中,没有则会自动创建

    • Jobs command and FG command:
     $ jobs
那么就会列出所有后台执行的作业,并且每个作业前面都有个编号。 

如果想将某个作业调回前台控制,只需要 fg + 编号即可。 $ fg 2

    • To view the PID of a thread occupied by a port
    NETSTAT-NLP |grep:8080

 

Running the jar file on a Linux cloud server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.