First question is why?
This class is for the exclusive use of ProcessBuilder.start() to create new processes. It's a private part of the internal technical implementation of Processes. It's definitely not a thing you should be messing about with at your level of Java expertise.
Process p = null;
pos = textArea.getCaretPosition();
String s = null;
p = Runtime.getRuntime().exec("cmd /C reg query \"HKEY_LOCAL_MACHINE\\SOFTWARE\\AutoIt v3\\AutoIt\"");
textArea.setSelectedText( p );
textArea.setCaretPosition( pos );
That's a snippet of my code. I'm working on an extension to jEdit which run off of Beanshell, the Java 'scripting language'. I'm trying to get the output of the Runtime line, but every method I've found eithe results in an error or the object descriptor.
I took over maintaining a project, and, this is actually the first time I've ever used Java, so everything I'm learning, I'm learning from the original author. If you guys have a better method to run a cmd command and get the output, please, let me know. I'll be more than happy to put you into the credits.
The Runtime.exec returns a Process object that describes the process. You can then use p.getInputStream() which returns the input stream connected to the normal output of the subprocess. The stream obtains data piped from the standard output of the process represented by this Process object. Once you have the input stream you can use standard Java IO classes and methods to read whatever your process writes to stdout.
Ths isn't the easiest way to learn Java, so good luck!
Hi, as I was told that my code doesn’t scale well at all, I thought perhaps I’d try to get a better understanding of interfaces/abstract classes and classes and the relationship between them.
I don’t want at this stage work on a big separate project as I've already got plenty ...
Hey, so I wanna ask how I need to create a method who will remove word if in that word is 2 same chars. Example: "Potato" in this word there is a 2 "o" chars so this word will need to be removed. "Forum" in this word there is no ...
Hi I'm having a problem implementing a mini shopping cart drop down in the header to show the user all the products they have in their shopping cart. It seems the only solution for this is Ajax, and I've looked all over and can't find anything that I could possibly ...