Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Launch .jar files with command line arguments (but with no console window)

I have to do a demo of an application, the application has a server.jar and client.jar. Both have command line arguments and are executable. I need to launch two instances of server.jar and two instances of client.jar.

I thought that using a batch file was the way to go, but, the batch file executes the first command (i.e. >server.bat [argument1] [argument2]) and does not do anything else unless I close the first instance, in which case it then runs the 2nd command. And also the I do not want a blank console window to open (or be minimized)

What I really need is a batch script that will just launch these apps without any console windows and launch all instances that I need.

Thanks in Advance!

EDIT:

javaw:

works if I type the command into the console window individually. If I put the same in the batch file, it will behave as before. Console window opens, one instance starts (whichever was first) and it does not proceed further unless I close the application in which case it runs the 2nd command. I want it to run all commands silently

like image 502
Virat Kadaru Avatar asked Apr 02 '09 20:04

Virat Kadaru


3 Answers

Found the solution, below is the contents of my batch file

@echo off

start /B server.jar [arg1] [arg2]  
start /B server.jar [arg3] [arg4]

start /B client.jar [arg5]
start /B client.jar [arg6]

@echo on

this opens, runs all the commands and closes the window, does not wait for the command to finish.

I am still not sure how to prevent the window from opening completely.

like image 113
Virat Kadaru Avatar answered Oct 03 '22 15:10

Virat Kadaru


Try:

javaw <args>
like image 29
McDowell Avatar answered Oct 03 '22 17:10

McDowell


Alright after tring and cring, here goes my soluction

@echo off
start /B javaw -jar -Xms16m -Xmx512m client.jar
@echo on

I hope it will be usefull for somebody.

like image 26
Tiago Lopes da Costa Avatar answered Oct 03 '22 15:10

Tiago Lopes da Costa