marcick Well-Known Member Licensed User Longtime User Aug 19, 2025 #1 Hi all, as the title says, from a B4J app acting as a "watchdog" I would like to: 1. Check if another B4J app (built as a standalone .exe, not a .jar) is currently running. 2. If it is, be able to kill it. 3. Restart it afterwards. This is running on Windows Server. Any hints or sample code would be very appreciated.
Hi all, as the title says, from a B4J app acting as a "watchdog" I would like to: 1. Check if another B4J app (built as a standalone .exe, not a .jar) is currently running. 2. If it is, be able to kill it. 3. Restart it afterwards. This is running on Windows Server. Any hints or sample code would be very appreciated.
Solution marcick Aug 20, 2025 Thank you. I discovered it is needed a B4j/ prefix: B4X: Wait For (Caller.KillJavaProcess("b4j/it.sample.main")) Complete (Counter As Int)
Thank you. I discovered it is needed a B4j/ prefix: B4X: Wait For (Caller.KillJavaProcess("b4j/it.sample.main")) Complete (Counter As Int)
Erel B4X founder Staff member Licensed User Longtime User Aug 19, 2025 #2 You can use JarCaller to kill it: JarCaller - Run and kill B4J jars Make sure to give the main app a unique package name. Starting is simple with jShell. Just call the executable. Upvote 0
You can use JarCaller to kill it: JarCaller - Run and kill B4J jars Make sure to give the main app a unique package name. Starting is simple with jShell. Just call the executable.
marcick Well-Known Member Licensed User Longtime User Aug 19, 2025 #3 Thants, I saw that example. No problem for starting with Jshell, but for killing it is not clear to me. Once the package name is for example it.sample and the exe name in sample.exe, how to use that code that looks for jar ? Upvote 0
Thants, I saw that example. No problem for starting with Jshell, but for killing it is not clear to me. Once the package name is for example it.sample and the exe name in sample.exe, how to use that code that looks for jar ?
Erel B4X founder Staff member Licensed User Longtime User Aug 20, 2025 #4 Try this: B4X: Wait For (Caller.KillJavaProcess("it.sample.main")) Complete (Counter As Int) Upvote 0
marcick Well-Known Member Licensed User Longtime User Aug 20, 2025 #5 Thank you. I discovered it is needed a B4j/ prefix: B4X: Wait For (Caller.KillJavaProcess("b4j/it.sample.main")) Complete (Counter As Int) Upvote 0 Solution
Thank you. I discovered it is needed a B4j/ prefix: B4X: Wait For (Caller.KillJavaProcess("b4j/it.sample.main")) Complete (Counter As Int)