Runtime process
3 Message(s) by 3 Author(s) originally posted in java programming
| From: jerry chapman |
Date: Friday, September 28, 2007
|
I am trying to send a
command to windows from my JAVA
program , and I get an
error .
The pertinent (?) part of my
code follows:
public boolean action(Event evt, Object arg)
{ if (arg.equals("Execute")){
inputText=(String)commandText.getText();
System.out.println(inputText);
try{
Runtime rt = Runtime.getRuntime();
//Process cp1=Runtime.getRuntime().exec(inputText);
//With the Runtime
instance the program is
run with the exec()
method:
Process
process = rt.exec (inputText);
}
catch(IOException ee){
System.err.println(ee+" can not run command");
System.exit(1);
}
}
else return super.action(evt,arg);
return true;
}
I have written other JAVA programs that successfully used this function, but
I do not know why this one does not work. Any suggestions?
| From: Andrew Thompson |
Date: Saturday, September 29, 2007
|
wrote in message:
I am trying to send a command to windows from my JAVA program, and I get an
error.
If that is a CodeIsDepressedException then the solution
is easy, we've drugs to treat that, in this day and age.
If it is something else, then you might progress the thread
by *stating* the exact exception, and perhaps even listing
a stacktrace that references the code lines that led to the
probem.
The pertinent (?) part of my code follows:
A good way to make sure the code includes the
pertinent lines is to prepare an SSCCE.
<http://www.physci.org/codes/sscce.html>
..
I have written other JAVA programs that successfully used this function, but
I do not know why this one does not work. Any suggestions?
Post an SSCCE with stacktrace.
--
Andrew Thompson
http://www.athompson.info/andrew/
Message posted via JAVAKB.com
http://www.JAVAkb.com/Uwe/Forums.aspx/JAVA-general/200709/1
| From: Joshua Cranmer |
Date: Saturday, September 29, 2007
|
wrote in message:
public boolean action(Event evt, Object arg)
If I remember correctly, this'd be the
event dispatch model in JAVA
1.0
deprecated by JAVA 1.1?
I have written other JAVA programs that successfully used this function, but
I do not know why this one does not work. Any suggestions?
1. Try using the more recent, non-deprecated
version of the event model.
It's only been around for five versions of JAVA, after all.
2. After that, what exactly is the clue that it isn't working? An error
message? No output? "It does not work" is very vague and is nearly
impossible to fix without more information.
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E.
Knuth
Next Message: newbie: setup of Runtime Environment
Blogs related to Runtime process
[jruby-scm] [jruby] [4320] trunk/jruby: Split up test/unit tests ...
getLoadService().init(loadPath); +
runtime.defineGlobalConstant("ARGV",
runtime.newArray()); + } + + private class ScriptTest extends TestCase {
private final String filename; private final File testDir; ...
New Trend in Attacking the Java Runtime Environment?
Attacks targeting vulnerabilities in the Java Runtime Environment are anything but new. Several researchers have previously visited this topic and the results have been some fantastic research. However, in recent weeks the DeepSight ...
Sun Alert 102993 Java Runtime Environment Does Not Securely ...
The Java XML Digital Signature implementation that is included in the JDK and JRE 6 release does not securely process XSLT stylesheets contained in XSLT Transforms in XML Signatures. This could lead to the execution of arbitrary code ...
JRE 6u2
about the data Sun collects at Java Runtime Environment Usage Metrics. For inquiries please contact: Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, California 95054, USA Do you agree to the above license terms? [yes or no] ...
The Geek Trap
BT: Right, but the user starts up the phone call process from within FB, all the status/contact information is within FB, only the actually call itself is a simple Java applet. Me: Right, but your application is -and I'm not saying ...
Problem with spawning a process in windows using Java Runtime.exec
Hi, I am trying to open a browser from a java program. And I am using runtime.exec to perform the same. The program does open the browser, but.