Questions tagged [java-process-runtime]

15 questions
3
votes
2 answers

Show output while execute long-time running command Java without waiting RuntimeExec

I have command that takes about 4 minutes to complete execution. While executing the command from windows command prompt, it shows timing information and continuous output. I want to show that output while running the command from my Java code.…
2
votes
1 answer

Get the value of a variable inside processBuilder in java

I want to download the file from s3 bucket using aws s3 cli command with process builder. The code is below. If I do not want to hardcode the file name I am getting the error. Can anyone please let me know how to pass the variable inside a…
1
vote
0 answers

how to run a shell script file from php

i am using apache based application where front end is php and backend as java through socket am sending requests from php to java. i am trying to run a shell script file in php and script contains killing old java process and will start new java…
1
vote
2 answers

process.waitFor() throws IllegalThreadStateException

Environment Windows 10 Java 1.8 Process I am running a 7zip's zip task. The process takes 2 to 3 hours to complete. Exception java.lang.IllegalThreadStateException: process has not exited at…
1
vote
0 answers

Java Process thread is running parallel, when command is executed directly in Java

When I am running the batch command ping 127.0.0.1 -n 5 > nul (waits 5 seconds) in Java "directly": public class Test { public static void main(String[] args) throws IOException, InterruptedException { Process…
Steve450
  • 113
  • 2
  • 7
1
vote
1 answer

How to get errors in Python subprocess created by java

I start the python process by java Runtime.getRuntime().exec("python pythonCode.py") method, I want to get to know about are there are any errors in python programm and what are those,can i do that?
0
votes
1 answer

How to know if the process has terminated while processing the inputstream and when should I call process.waitFor() or process.exitValue()?

I am trying to execute commands using Java. So when I try to convert the process Inputstream to string using BufferedReader, the code works if I call process.waitFor() after processing the inputstream to string. But when I try to convert the…
0
votes
0 answers

Is ByteArrayOutputstream to string conversion from process inputstream works faster instead of using StringBuffer

I have been trying to execute commands using java. And I trying to figure a fastest way to convert process inputstream to string. On reading a lot, I found that ByteArrayOutputstream is faster. Is i t faster comparing to StringBuffer conversion? I…
0
votes
0 answers

Feeding a created subprocess with data in Java

I started to learn about processes in Java, so following question popped up. Let's say that I have some text data stored in variable. I want to start notepad.exe by starting a new process and somehow to pass this text data to it, so it can be shown.…
Darian Pudic
  • 45
  • 2
  • 10
0
votes
0 answers

Java start qemu-system-gnuarmeclipse.exe on Windows and meet problem for output

On Win10, I write a Java program to start qemu-system-gnuarmeclipse.exe, show below: String cmd = "C:/Users/DELL/AppData/Roaming/xPacks/@xpack-dev-tools/qemu-arm/7.0.0-1.1/.content/bin/qemu-system-gnuarmeclipse.exe --verbose --board…
OldHu
  • 49
  • 3
0
votes
1 answer

When I pass more than three options using apache commons CLI..the result is displaying as NULL for third option

When I pass more than three options in cmd..the result is displaying as NULL package main.java; import org.apache.commons.cli.*; public class cli { public static void main(String[] args) throws Exception { Options options = new…
0
votes
1 answer

Windows java.exe -jar with spaces

I know there are already dozens of questions out there about dealing with executing system commands that have paths with spaces in Java, but I've not found a solution to my exact situation yet. I'm using java.exe that comes with jdk-1.8.x on a…
owengall
  • 455
  • 4
  • 11
0
votes
1 answer

BufferHow to get STDIN line color with JAVA using BufferedReader

Im run FFplay process in my JAVA application and read his logs with BufferedReader. I want to parse the logs to determine errors. So I want to read the color for each line. red for errors.. bufferedReader.readline() return the content, no any color…
Matan Marciano
  • 103
  • 1
  • 12
-1
votes
1 answer

Find Process Count in Java

I am able to launch Process with the help of below command and after launching multiple processes I want to control how many processes I want to keep at some point. For example: Initiate a Process inside a for loop of range 0 to 50 Pause the for…
paul
  • 4,333
  • 16
  • 71
  • 144
-2
votes
1 answer

How to call an internal Python service for a Java-based Spring Boot project

I have the following problem and I am asking for the better approach. I have to execute a Python script from the inside of a Spring Boot project. The script should be pretty easy but was made by other people and if possible I want to avoid the…
AndreaNobili
  • 40,955
  • 107
  • 324
  • 596