How to get unix process ID when running java -jar command

SEY_91

Is it possible to get the process id of a standalone java application in unix when we run java -jar command. I am using this command to start the application

java -jar application.jar > application-console.out 2>&1 &

and to get the process id I am using this command

processID=$(ps aux | grep 'application.jar' | grep -v 'grep' | awk '{print $2}')

but my problem is the previous command will search any java jar process for the application.jar but what I am looking for is the one that has been just started.

Poshi

The PID of the last executed command is in the $! shell variable:

java -jar application.jar > application-console.out 2>&1 &
echo $!

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to get the command line args passed to a running process on unix/linux systems?

From Dev

Unix/Java process stops running when moved to background

From Java

Linux/Unix command to determine if process is running?

From Dev

how to get process id of a running process as shown in task manager

From Dev

Spring Boot Jersey - Missing EmbeddedServletContainerFactory when running java -jar command

From Dev

How to find the process id of a process running on a port number in java

From Dev

How to get name of user account running a process on Windows command line?

From Dev

How to get the process that is running

From Dev

How to move a running process to background (UNIX)

From Dev

Sending input to a running JAR via Java process

From Java

How to find the process id of a running Java process on Windows? And how to kill the process alone?

From Dev

How to find the process id that is running my Java Application

From Java

include external jar when running java -jar

From Dev

How to write process ID and get exit code of the next to last command

From Java

Not enough Storage is available to process this command when running java utilities from command line

From Dev

How can I execute jar file in UNIX-like using this command line: java -jar mysolution.jar < inputfile.txt

From Dev

Running a java -jar command from a batch file

From Dev

How to get the ExitCode of a running process

From Dev

How to fix "'bool' object is not iterable" error when running a UNIX command on a directory of files in python

From Dev

When running a java command with the -jar option, can you supply additional libraries using -cp?

From Dev

How to get the command line arguments running java in IntelliJ IDEA 14.1

From Dev

How do I get node or process id when using doParallel?

From Java

How do you get the process ID of a program in Unix or Linux using Python?

From Dev

How to specify a different main class when running a scala jar on the command line?

From Dev

Unix Running Tar Command

From Dev

Saving a process ID when detaching a command in Bash

From Java

Linux command get tomcat process id by name

From Dev

[SOLVED]how to find out which path is running a process when it is shown in blank / empty in the command line of the task Manager

From Dev

How to keep running a process in Android when disconnecting adb terminal? command "nohup" not found

Related Related

  1. 1

    How to get the command line args passed to a running process on unix/linux systems?

  2. 2

    Unix/Java process stops running when moved to background

  3. 3

    Linux/Unix command to determine if process is running?

  4. 4

    how to get process id of a running process as shown in task manager

  5. 5

    Spring Boot Jersey - Missing EmbeddedServletContainerFactory when running java -jar command

  6. 6

    How to find the process id of a process running on a port number in java

  7. 7

    How to get name of user account running a process on Windows command line?

  8. 8

    How to get the process that is running

  9. 9

    How to move a running process to background (UNIX)

  10. 10

    Sending input to a running JAR via Java process

  11. 11

    How to find the process id of a running Java process on Windows? And how to kill the process alone?

  12. 12

    How to find the process id that is running my Java Application

  13. 13

    include external jar when running java -jar

  14. 14

    How to write process ID and get exit code of the next to last command

  15. 15

    Not enough Storage is available to process this command when running java utilities from command line

  16. 16

    How can I execute jar file in UNIX-like using this command line: java -jar mysolution.jar < inputfile.txt

  17. 17

    Running a java -jar command from a batch file

  18. 18

    How to get the ExitCode of a running process

  19. 19

    How to fix "'bool' object is not iterable" error when running a UNIX command on a directory of files in python

  20. 20

    When running a java command with the -jar option, can you supply additional libraries using -cp?

  21. 21

    How to get the command line arguments running java in IntelliJ IDEA 14.1

  22. 22

    How do I get node or process id when using doParallel?

  23. 23

    How do you get the process ID of a program in Unix or Linux using Python?

  24. 24

    How to specify a different main class when running a scala jar on the command line?

  25. 25

    Unix Running Tar Command

  26. 26

    Saving a process ID when detaching a command in Bash

  27. 27

    Linux command get tomcat process id by name

  28. 28

    [SOLVED]how to find out which path is running a process when it is shown in blank / empty in the command line of the task Manager

  29. 29

    How to keep running a process in Android when disconnecting adb terminal? command "nohup" not found

HotTag

Archive