Using batch to run multiple java programs

239
April 25, 2018, at 03:25 AM

I wrote a batch file to run multiple batch files which run a java program separately. I am wondering if I need to pass an argument to the java program when I run it, how do I pass the argument when I start the station batch files? The main batch file looks like this:

@ECHO OFF
set CLASSPATH=.
ECHO open Server 
start Server.bat
ECHO open station1
start station1.bat
ECHO open station2 
start station2.bat
ECHO open station3 
start station3.bat
ECHO open station4 
start station4.bat

The station batch file looks like this:

@ECHO OFF
set CLASSPATH=.
java ClientStation  arg1  arg2   arg3
pause
Answer 1

Change station.bat from

java ClientStation  arg1  arg2   arg3

to

java ClientStation  %*

which will pass command line arguments on to ClientStation. And when you call it, call it like

start station1.bat arg1 arg2 arg3

Or use %* if you want to pass command line arguments from that script onto station.bat

Rent Charter Buses Company
READ ALSO
Best practices for web service extension

Best practices for web service extension

I have a maven-based multi-territory RESTful Java web service using JAX-RS (Jersey) deployed on Grizzly and using CDI (WELD) for Dependency InjectionIt runs as a stand-alone application (inside a Docker container) to wire-up the Server and CDI in App

165
Delay/ Wait-time in getting access to fork-join thread pool from main applications thread

Delay/ Wait-time in getting access to fork-join thread pool from main applications thread

I have a fork-join thread pool with parallelism of #of cpu's *12 (4 * 12) in my caseThey do db operation in parallel

156
Factories in conjunction with XML-files to set up a program

Factories in conjunction with XML-files to set up a program

up to this point I used config files (mainly XMLs) to store different configurations for my programThe program is highly modular

170
Retrieve @JsonProperty value set in an enum

Retrieve @JsonProperty value set in an enum

How do you retrieve the value set in a @JsonProperty annotation?

243