3

I am using a batch file to invoke a GUI. This GUI has a button (B1) that on click invokes a copy of itself. Now I want to increase the priority of the GUI whether it's run from the batch or button B1.

With batch, I am able to increase it's priority but not with B1.

The following code executes on click of button B1: (I am using cmd to increase the priority; I don't know if there is any other way)

final ProcessBuilder processBuilder = new ProcessBuilder("cmd", 
  " /C", 
  " start /high", 
  path,
  "-DTESTKERNEL_PROPERTIES=" + tempFile.getCanonicalPath(),
  "-Djava.util.logging.config.file=" + loggingFile,
  "-Djava.library.path=" + libraryPath,
  "-cp",
  classpath,
  "com.abc.cde.gui.typetwo.GuiTypeTwo");
processBuilder.directory(new File(System.getProperty("user.dir")));

DTESTKERNEL_PROPERTIES is a properties file and is required for the execution of code.

This is the output as list:

cmd, 
/C, 
start, 
/high, 
D:\jdk\jre\bin\javaw, 
-DTESTKERNEL_PROPERTIES=C:\Users\test\AppData\Local\Temp\testkernel2667928753863437728.properties, 
-Djava.util.logging.config.file=../config/logging.properties, 
-Djava.library.path=D:\TestKernalMain\lib, 
-cp, 
D:\Workspace\TestKernalMain\bin;
D:\TestKernalMain\lib\bundled\bsh-2.0b5.jar;
D:\TestKernalMain\lib\bundled\commons-cli-1.2.jar;
D:\TestKernalMain\lib\bundled\commons-collections-3.2.1.jar;
D:\TestKernalMain\lib\bundled\commons-configuration-1.8.jar;
D:\TestKernalMain\lib\bundled\commons-io-2.0.jar;
D:\TestKernalMain\lib\bundled\commons-lang-2.5.jar;
D:\TestKernalMain\lib\bundled\commons-logging-1.1.1.jar;
D:\TestKernalMain\lib\bundled\commons-net-2.2.jar;
D:\TestKernalMain\lib\bundled\commons-vfs2-2.0.jar;
D:\TestKernalMain\lib\bundled\eventbus-1.4.jar;
D:\TestKernalMain\lib\bundled\javasimon-core-2.3.0.jar;
D:\TestKernalMain\lib\bundled\javasimon-jmx-2.3.0.jar;
D:\TestKernalMain\lib\bundled\jpcsc.jar;
D:\TestKernalMain\tools\ant\ant-antlr.jar;
D:\TestKernalMain\tools\ant\ant-apache-bcel.jar;
D:\TestKernalMain\tools\ant\ant-apache-bsf.jar;
D:\TestKernalMain\tools\ant\ant-apache-log4j.jar;
D:\TestKernalMain\tools\ant\ant-apache-oro.jar;
D:\TestKernalMain\tools\ant\ant-apache-regexp.jar;
D:\TestKernalMain\tools\ant\ant-apache-resolver.jar;
D:\TestKernalMain\tools\ant\ant-apache-xalan2.jar;
D:\TestKernalMain\tools\ant\ant-commons-logging.jar;
D:\TestKernalMain\tools\ant\ant-commons-net.jar;
D:\TestKernalMain\tools\ant\ant-contrib.jar;
D:\TestKernalMain\tools\ant\ant-jai.jar;
D:\TestKernalMain\tools\ant\ant-javamail.jar;
D:\TestKernalMain\tools\ant\ant-jdepend.jar;
D:\TestKernalMain\tools\ant\ant-jmf.jar;
D:\TestKernalMain\tools\ant\ant-jsch.jar;
D:\TestKernalMain\tools\ant\ant-junit.jar;
D:\TestKernalMain\tools\ant\ant-junit4.jar;
D:\TestKernalMain\tools\ant\ant-launcher.jar;
D:\TestKernalMain\tools\ant\ant-netrexx.jar;
D:\TestKernalMain\tools\ant\ant-swing.jar;
D:\TestKernalMain\tools\ant\ant-testutil.jar;
D:\TestKernalMain\tools\ant\ant.jar;
D:\TestKernalMain\tools\cardreader\javactapi.jar;
D:\TestKernalMain\tools\iText\iText-2.1.7.jar;
D:\TestKernalMain\tools\iText\iText-rtf-2.1.7.jar;
D:\TestKernalMain\tools\jdiff\antjdiff.jar;
D:\TestKernalMain\tools\jdiff\jdiff.jar;
D:\TestKernalMain\tools\jdiff\xerces.jar;
D:\TestKernalMain\tools\JUnit\junit.jar;
D:\TestKernalMain\tests\lib\cglib-nodep-2.2.2.jar;
D:\TestKernalMain\tests\lib\easymock-3.0.jar;
D:\TestKernalMain\tests\lib\jetm-1.2.3.jar;
D:\TestKernalMain\tests\lib\jetm-optional-1.2.3.jar;
D:\TestKernalMain\tests\lib\obj-1.2.jar;
D:\Workspace\GUITypeTwo\bin;
D:\TestKernalMain\lib\TestKernel.jar;
D:\GUITypeTwo\lib\external\docking-frames-core.jar;
D:\GUITypeTwo\lib\external\docking-frames-common.jar;
D:\GUITypeTwo\lib\external\glasslib.jar;
D:\GUITypeTwo\lib\external\docking-frames-ext-glass.jar;
D:\GUITypeTwo\lib\external\h2-1.3.167.jar;
D:\GUITypeTwo\lib\external\mydoggy-api.jar;
D:\GUITypeTwo\lib\external\mydoggy-plaf.jar;
D:\GUITypeTwo\lib\external\mydoggy-res.jar;
D:\GUITypeTwo\lib\external\swingx-core-1.6.2.jar;
D:\GUITypeTwo\lib\external\TableLayout.jar;
D:\GUITypeTwo\lib\external\ValidationAPI.jar;
D:\GUITypeTwo\tools\MPlus.jar;
D:\GUITypeTwo\tools\JUnit\junit-4.9.jar;
D:\TestKernalMain\config, 
com.gui.typetwo.GuiTypeTwo

1 Answer 1

1

Remove the spaces before /C and start and split "start /high" into two separate parameters:

new ProcessBuilder("cmd", "/C", "start", "/high", ...)
Sign up to request clarification or add additional context in comments.

13 Comments

It says "windows can not find -DTESTKERNEL_PROPERTIES=" i cross checked and found that the file is present at the desired location
What is the value of path? Can you first put all process arguments in a list, print it, post the output in your original question and then invoke new ProcessBuilder(list)? There must be some typo or other minor issue there.
The arguments have proper values, i tried to use the list instead. Gives the same result. "Windows cannot find......."
Please help anyone. Am really stuck here!
Well, I asked you some questions that you didn't answer (you only said that "the arguments have proper values" - if they did, there wouldn't be a problem), so without more insight there's not much that can be done. Please put all arguments in a list and post the toString() of that list here.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.