How to run jar package command in Linux

零到壹度
Release: 2023-03-22 13:38:02
Original
8032 people have browsed it

This article mainly shares with you how to run the jar package command in Linux. Let's take a look at the effect first, hoping to help everyone.

Linux The command to run the jar package is as follows:

Method 1:

  1. java -jar shareniu.jar

Features: The current ssh window is locked, you can press CTRL + C to interrupt the program running. Or close the window directly and the program exits

How to prevent the window from locking?

Method 2

  1. #java -jar shareniu.jar &

& means running in the background.

Specific: The current ssh window is not locked, but when the window is closed, the program terminates.

Continue to improve, how to make the program still run when the window is closed?

##Method 3

nohup java -jar shareniu.jar &

nohup means running the command without hanging up. When the account is logged out or the terminal is closed, the program is still running.

When the nohup command is used to execute a job, by default all the commands of the job will be executed. Output is redirected to the file nohup.out unless an output file is specified otherwise.

Method 4

    #nohup java -jar shareniu. jar >temp.txt &

Explain >temp.txt

##command >out.file

##command >out.file redirects the command output to the out.file file, that is, the output content is not printed on the screen, but is output to the out.file file.

You can view background running tasks through the jobs command

    ##jobs
  1. Then all jobs executed in the background will be listed, and each job will have a number in front of it.
If you want to call a job back to the foreground control, just fg + number.


    fg 23
  1. ##View the pid of the thread occupied by a certain port

netstat -nlp |grep :9181

Related recommendations:

How to run jar files

How to execute the .jar file in the command line?

How to run the jar package The command line prompts that there is no manifest attribute

The above is the detailed content of How to run jar package command in Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template