processbuilder

I've already created a Process Builder. How do I run all of the programs in the Process builder?

爱⌒轻易说出口 提交于 2019-12-13 09:25:51
问题 Heere is the code I have so far. How do I have miktex-pdftex run? List<String> processes = new ArrayList<String>(); processes.add("miktex-pdftex --output-directory=[Directory] [file_name].tex"); ProcessBuilder processbuild = new ProcessBuilder(processes); 回答1: First, you need to make sure the command you are using actually works at the command. If it does not, then it's not going to work in Java. Next, one of the main reasons for using ProcessBuilder is to deals with spaces in the command

java.io.EOFException when serialize object from child process and try to de-serialize from parent process ProcessBuilder

删除回忆录丶 提交于 2019-12-13 08:39:58
问题 I am creating a new process using java ProcessBuider and I want an object to be sent to the parent from the creating child. Here, I serialize the object from child side and send it to the parent. But when I read the sent object from parent, there is an exception saying java.io.EOFException at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source) Felt like still there are no streams receive to the parent when I am trying to read that. Parent, Child and the Sending object java

Thread-safe way to call an external process (and grab its output stream) from inside an EJB

…衆ロ難τιáo~ 提交于 2019-12-13 08:07:52
问题 How do I call an external process in a thread safe way from inside an EJB? ProcessBuilder is not thread safe, as stated in the javadoc. Apache commons exec says nothing about thread-safety and I am not confident in Runtime.exec either. What's the proper way? let me add some code so people won't think I am abusing, this code sometimes works, sometimes not public int startTask(Logger logger, String expectPath, String expectScriptPath, long ticket) throws IOException { Runtime r = Runtime

using Process.exec

大兔子大兔子 提交于 2019-12-13 06:44:57
问题 I want to execute a batch file (this will start another java app) in the middle of my program. I dont want to wait or see whether it executed successfully nor I wanted to capture erros from executing that batch file. After I started that batch file , I want to do other stuff rather than waiting for it after i execute that batch. Do I need to take care of stdout and stderr? IS there any way to get rid of taking care of stdout and stderr. This is my second post to clear my confusion on this

Running Windows .exe file with multiple arguments using Java ProcessBuilder is not producing any output file as expected

↘锁芯ラ 提交于 2019-12-13 06:18:45
问题 I am trying to run an external .exe program in Windows 7 from my Java code using ProcessBuilder ProcessBuilder pb = new ProcessBuilder("C:\\hMetis\\1.5.3-win32\\hmetis.exe", "test.hgr", "2", "1", "10", "1", "1", "1", "0", "0"); Process process = pb.start(); However, when I run this standalone .exe from Windows using cmd it outputs the results in the command prompt as well as producing a file containing the results. I am not seeing any of these two happening while running the .exe from Java

Opening a new tab on an existing Internet Explorer (from Command Line)

≯℡__Kan透↙ 提交于 2019-12-13 06:01:37
问题 I would like to run a command on the command prompt (in Windows) that will open Internet Explorer with certain perks. Scenario (starting with no Internet Explorer opened): Run "iexplore google.ca" to open google.ca, as a new tab, on Internet Explorer Run "iexplore yahoo.ca" again to open yahoo.ca, as a new tab, on the recently opened Internet Explorer End result should have 2 tabs on one Internet Explorer application/window. I would like the above behavior but Internet Explorer will just open

Why doesn't the Java console show when using ProcessBuilder?

坚强是说给别人听的谎言 提交于 2019-12-13 04:17:13
问题 I use the following to launch a Java application from another Java app. ProcessBuilder pb = new ProcessBuilder(javaPath + javaCommand, maxMemStr, minMemStr, stackSizeStr, jarCommand, jarfile, jarArg); try { Process p = pb.start(); } catch (IOException ex) { Logger.getLogger(launch.class.getName()).log(Level.SEVERE, null, ex); } where javaCommand is either java or javaw (javaPath is empty most of the time unless a user points to an alternate path). The problem is, after the app launches, even

Why can't I execute a Cygwin .exe directly with Java on Windows?

感情迁移 提交于 2019-12-13 02:47:45
问题 I've installed Cygwin but can't seem to access any commands directly. For example, the process below doesn't start due to bash.exe not found even though I'm specifying it's absolute path. I know it's installed correctly since I can see this path in the File Explorer. However, searching for any cygwin file doesn't return any hits which is odd. ProcessBuilder pb = new ProcessBuilder("C:\\cygwin64\\bin\\bash.exe", "-c", "ls"); Process p = pb.start(); java.io.IOException: Cannot run program "‪C:

Input various strings to same process in Java

纵然是瞬间 提交于 2019-12-13 01:55:20
问题 I am writing a Java program which accesses a compiled C++ program via a ProcessBuilder. The C++ program takes a while to "start up", but once it has done so, it can take in strings of text and get an output (currently being written to a text file) very quickly. Essentially, is there a way to have a running process "wait" for an input to be given to it, rather than have to enter the input source as it is started? I don't want to have to restart a process every time a user inputs a String, as

Calling C compiler from java program

試著忘記壹切 提交于 2019-12-12 19:26:37
问题 I have a project for which I need to compile C programs. The project is in Java. I have to take the program into a JTextArea,(I am using Swing for GUI) , run it against a testfile and output the results into another JTextArea. But something seems to be wrong in my code. Process p = new ProcessBuilder("c:\\MinGW\\bin\\cc.exe", "program.c").start(); program.c contains the program that user enter into TextArea, and "c:\MinGW\bin\cc.exe" is my c compiler. I checked that this is not raising any