John F. Dumas Vulcan Ware
_blank_
Runner
Below are zip files for windows and linux. Each zip file contains source code as well as prebuilt executable files. Also included is 'notes.txt', runner's documentation which is also included here below the zip file links.
Windows       Linux

Runner is a cross platform (tested on linux/win32) application
for launching programs with long or complex command line arguments.

The program reads a .txt file containing variable definitions and executes
a specified variable definition.  For example, here's the file my.txt
which I use to launch mysql on linux:

   tm     = /tools/mysql
   mysqld = %tm%/bin/mysqld
   arg1   = --defaults-extra-file=%tm%/data/my.cnf
   arg2   = --basedir=%tm%
   arg3   = --datadir=%tm%/data
   arg4   = --pid-file=%tm%/data/mysql.pid
   arg5   = --skip-locking
   arg6   = --bind-address=127.0.0.1
   cmd    = %mysqld% %arg1% %arg2% %arg3% %arg4% %arg5% %arg6%

As you can see, other keys in the file can be referenced via %key_name%.
To run mysql as a foreground process:

   runner.exe my.txt cmd

As a background process:

   runner.exe my.txt cmd &

For debugging output, set the environment variable RUNNER_DEBUG to
something starting with: { y, Y, t, T, 1 }.  On windows, runner comes
in two flavors:

   runner.exe  => behaves like linux version, runs as a console app
   runnerh.exe => runs "headless" - that is, without a console

To build the program on linux:

   g++ -W -Wall -o runner.exe runner.cpp

To build the console version on windows:

   cl -W3 -GX runner.cpp

To build the headless version on windows:

   cl -DHEADLESS -W3 -GX -c runner.cpp
   link /out:runnerh.exe /subsystem:windows runner.obj

In recent years, launching java applications has become much easier,
typically accomplished via:

   java.exe -jar someFile.jar

However, if your program uses many jar files from external packages, you'd
have to create the "one true jar file" containing all those jars in
order to launch your application using '-jar'.

Using runner, you can structure your installation as you please and
still launch your application with a single, simple command.

Here's a txt file setup I use to test an application I've been
working on lately that needs a specific jvm, class path and four
external jar files:

   # ------------
   # rank.txt
   # ------------

   jbin  = c:\java\jdk6\bin
   java  = %jbin%\java
   zs    = g:\projects\test\zscrape
   jdir  = %zs%\jar
   j1    = %jdir%\jfd.jar
   j2    = %jdir%\js.jar
   j3    = %jdir%\saxon8.jar
   j4    = %jdir%\tagsoup-1.1.3.jar
   jars  = %j1%;%j2%;%j3%;%j4%
   cp    = %zs%;%jars%
   cmd   = %java% -cp %cp% Client
   rank  = %cmd% %zs%\files\rank.js %*%

Note the use of '%*%' in the value of 'rank'.  This means
"all command line arguments", you can also reference specific
command line arguments via %1%, %2%, etc.  One could invoke the
above command 'rank' via:

   runner.exe rank.txt rank fractorama.com fractal art prints
                 ^      ^   ^...............................^
                 |      |                   |
                 |      |       all command-line args (%*%)
                 |      |
                 |      + -- command name
                 |
                 + -- text file name

Which is equivalent to running (long lines broken via '+') ...

   c:\java\jdk6\bin\java -cp g:\projects\test\zscrape; +
      g:\projects\test\zscrape\jar\jfd.jar;            +
      g:\projects\test\zscrape\jar\js.jar;             +
      g:\projects\test\zscrape\jar\saxon8.jar;         +
      g:\projects\test\zscrape\jar\tagsoup-1.1.3.jar   +
      Client g:\projects\test\zscrape\files\rank.js    +
      fractorama.com fractal art prints

The headless version, runnerh.exe can be used to launch (for example)
java gui programs in a straightforward fashion

   # ------------
   # ss.txt
   # ------------

   jbin   = c:\java\jdk6\bin
   javaw  = %jbin%\javaw
   jfc    = c:\java\jdk6\demo\jfc
   ss_jar = %jfc%\swingset2\swingset2.jar
   ss     = %javaw% -jar %ss_jar%

The SwingSet2 demo can then be launched via:

   runnerh.exe ss.txt ss

And no console window will be visible.  Note that RUNNER_DEBUG
still works when using runnerh.exe, just that the messages won't
be sent to the console but rather to alert boxes.

Return to Main