jdeploy
jdeploy copied to clipboard
Runtime.getRuntime().exec doesn't work
When running JAR directly, Runtime.getRuntime().exec("git") works, but running via the installed command, it doesn't work.
Exception in thread "main" java.io.IOException: Cannot run program "git": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.ProcessBuilder.start(Unknown Source)
at java.base/java.lang.Runtime.exec(Unknown Source)
at java.base/java.lang.Runtime.exec(Unknown Source)
Any idea?
What operating system? Is it a GUI app, or are you running through the CLI? Installed via npm install or via double-clickable desktop installer?
Are both running in same terminal environment? (in same terminal window)?
What operating system?
macOS
Is it a GUI app, or are you running through the CLI?
CLI
Installed via npm install or via double-clickable desktop installer?
Installed via sudo jdeploy install
Are both running in same terminal environment? (in same terminal window)?
Yes
You might want to check the environment (e.g. System.getenv()) to see what the difference is. Particularly in the PATH environment variable.
Both are same. Confirm
UPDATE: The issue is not there in 1.022. I think its a regression came in ^3.0.0
Is it the same java version?
Yes. Steps to reproduce
- Create a new gradle based Kotlin project
- Call
Runtime.getRuntime.exec("git") - Export
jar - Run
jarthrough terminaljava -jar my.jar(this will work) - Now install app using
sudo jdeploy installand run the app from terminal
Those will be different versions of java.
Please post output of both system properties and env vars printed from inside the java app.