I used to run a jar in background with below syntax on a linux machine as below :
java -jar ./target/myjar-0.0.1-SNAPSHOT.jar > /dev/null 2>&1
But now i have a requirement to run the same jar in background on the Powershell on a windows machine . (I am not using Powershell Core version which allows use of & keyword for running background jobs , my version is 5.1)
I tried running my jar in background as below based on this answer here on StackOverflow (https://stackoverflow.com/a/25035181/4193280):
Start-Job -ScriptBlock {
& java -jar ./target/myjar-0.0.1-SNAPSHOT.jar >console.out 2>console.err
}
But still the jar is not executing and i am not able to connect on my application on port 9090 (that is where i have configured it to run) .
Please let me know and help where i am missing the point so that i can execute the jar in background . Thank you .