0

I need to run two JAR files (one with Java 32 and the other one with java 64 bits, because I use some DLLs for 32 bits system) with a single batch file. The one that runs with Java 64 bits works, but the one for Java 32 bits doesn't.

Here is the bat:

start "%ProgramFiles%/Java/jre1.8.0_144/bin/java.exe -Xmx4096m -jar" Application1.jar
timeout 2
start "%ProgramFiles(x86)%/Java/jre1.8.0_121/bin/java.exe -Xmx1024m -jar" Application2.jar

The both of them are server applications, but the second one uses some DLLs that works only for 32 bits systems.

halfer
  • 19,824
  • 17
  • 99
  • 186
  • First try your Command without the start, you will see an error with the quotes: close your quote after java.exe, then using dll, you could have lib path problem – pdem Oct 16 '17 at 15:43
  • If i do so, only the first one starts and waits until it stops running to start the second one, but i need the first to be able to start the second one. The thing is that if i start both applications from different batchs, both starts working, but when i try to do so with only one batchs file, the second doesn't starts working. – user8785143 Oct 17 '17 at 12:02
  • There is a mismatch in your quotes, removed them and check in your script, Also just for test purpose, launch the start separatly in console, it should be: `start %ProgramFiles%/Java/jre1.8.0_144/bin/java.exe -Xmx4096m -jar Application1.jar` – pdem Oct 17 '17 at 13:44
  • Without the quotes, It tries to run C:\Program and ignore the path – user8785143 Oct 17 '17 at 14:35
  • well just around the java call then, (or add java to the path): `start "%ProgramFiles%/Java/jre1.8.0_144/bin/java.exe" -Xmx4096m -jar Application1.jar` – pdem Oct 17 '17 at 14:46
  • It show a error again Windows cannot find 'Xmx4096m'. Mane sure you typed the name correctly, and then try again. – user8785143 Oct 17 '17 at 14:52
  • Yes it's because of spaces in programfiles and arguments, you may use cmd /k with will fit the same functionnality see https://stackoverflow.com/questions/12891383/correct-quoting-for-cmd-exe-for-multiple-arguments: `cmd /k ""%ProgramFiles%/Java/jre1.8.0_144/bin/java.exe" -Xmx4096m -jar Application1.jar"` – pdem Oct 18 '17 at 07:14
  • It works but only runs the first application. Finally i found a solution where i use the quotes before the path: start "" "%ProgramFiles%/Java/jre1.8.0_144/bin/java.exe" -Xmx4096m -jar Application1.jar timeout 2 start "" "%ProgramFiles(x86)%/Java/jre1.8.0_121/bin/java.exe" -Xmx1024m -jar Application2.jar Thanks for your help and sorry for the inconveniences :) – user8785143 Oct 18 '17 at 08:24
  • ok, good for you that it works. – pdem Oct 18 '17 at 08:26

0 Answers0