Re: Windows priorities with runtime.exec



Daniel Pitts <newsgroup.spamfilter@xxxxxxxxxxxxxxxxxxx> wrote in
news:XUfPn.140043$0M5.115193@xxxxxxxxxxxx:

On 6/7/2010 12:41 PM, Ian Shef wrote:
Hakan<H.L@xxxxxxxxxxxx> wrote in
news:1275913595.04@xxxxxxxxxxxxxxxxxx:

<snip>
In order to run a SAS job from a Java program, we are using a simple
runtime.getruntime.exec({"C:/Program
Files/sas.exe","myloc/myfile.sas"}).
That works great, but my boss wants to have it run with a set lower
priority so that it doesn't interrupt other tasks on the server. How
do I do that?
<snip>

Your example has bad capitalization and will not compile. However...

I have not tried this, but I am going to guess that the solution
involves the "start" command. If you have Windows XP, you might try:

Runtime.getRuntime.exec({"C:/WINDOWS/system32/cmd.exe", "/C", "START",
"/BELOWNORMAL", "C:\\Program Files\\sas.exe", "myloc/myfile.sas"}) ;


I have turned some forward slashes into double backslashes.
Backslashes are needed to meet the expectations of the START command,
and doubling is required for Java strings.

I don't have the right environment to try this, but perhaps it is close
enough to give someone an idea. Perhaps there is an easier way.

Good luck!



Sounds reasonable, although I would suggest wrapping the whole thing in
a BAT file, to separate the "priority" of the running app from the
concern of the runner app.

Even better than my solution. I like it!


.



Relevant Pages

  • Re: Windows priorities with runtime.exec
    ... I have turned some forward slashes into double backslashes. ... needed to meet the expectations of the START command, ... Sounds reasonable, although I would suggest wrapping the whole thing in a BAT file, to separate the "priority" of the running app from the concern of the runner app. ...
    (comp.lang.java.programmer)
  • exec or spawning a tcl program using winXP START
    ... fine if I launch the program from a command line e.g. ... However when I try and put this into a spawn command I run into ... while executing ... Any help on changing the Base Priority of a spawned process from ...
    (comp.lang.tcl)
  • Re: BLAME BUSH.
    ... command. ... Getting the job done is priority number one for a leader. ... >>> Bush is not particularly good in emergencies. ... >> Emergencies are really the main priority of the President. ...
    (rec.audio.pro)
  • nice bandwidth usage
    ... There exists the "nice" command which schedules processes with lower CPU ... priority, and the "ionice" command to give processes lower I/O priority. ...
    (comp.os.linux.misc)
  • Re: start with /wait and /b together
    ... I want to start command line tool from a batch, ... In fact, I just want to start the tool.exe with lower priority, start /low ... Perhaps you could split the batch into two, as the last command of the first ...
    (microsoft.public.win2000.cmdprompt.admin)