Kickers

Kickers


Disclaimer

This essay does not describe an existing computer program, just one that should exist. This essay is about a suggested student project in Java programming. This essay gives a rough overview of how it might work. I have no source, object, specifications, file layouts or anything else useful to implementing this project. Everything I have prepared to help you is right here.

This project outline is not like the artificial, tidy little problems you are spoon-fed in school, when all the facts you need are included, nothing extraneous is mentioned, the answer is fully specified, along with hints to nudge you toward a single expected canonical solution. This project is much more like the real world of messy problems where it is up to you to fully the define the end point, or a series of ever more difficult versions of this project, and research the information yourself to solve them.

Everything I have to say to help you with this project is written below. I am not prepared to help you implement it; or give you any additional materials. I have too many other projects of my own.

Though I am a programmer by profession, I don’t do people’s homework for them. That just robs them of an education.

You have my full permission to implement this project in any way you please and to keep all the profits from your endeavour.

Please do not email me about this project without reading the disclaimer above.

The Problem

The command line to launch a program is often long and unwieldy. It may require many set commands, a huge long classpath, many system parameters and many program parameters. Some of the lines might be too long even to fit on a bat file line. Further, bat files require a useless, ram-wasting, command interpreter resident the entire time your program is running and a confusing DOS (Disk Operating System) window. You don’t want to add yet another directory to your path just to be able to launch the application. You want to be able to start the app typing just one word.

Windows shortcuts are lame. They don’t let you specify command line parameters. They don’t let you fill in any additional information at launch time.

The Solution

You compose a custom little C or MASM (Microsoft Assembler) program whose sole job in life is to launch your app. I call these little launch programs kickers. A kicker sets up the set environment, including the classpath, and exec’s your app passing it all the parameters. Usually the app would be javaw.exe but it could be any exe or com. Ideally the kicker would exit as soon as the app was launched (so long at that would not kill the child.) In any case, you want to keep the kicker small and fast with no user interface.

You then put this kicker either on the path or on the virtual path in the registry auxiliary path so that it is always accessible just by typing a single word.

The problem with C doing an exec is you have an anomynmous copy of java.exe visible in the task manager, instead of the original executable name. To get around this, there is an invocation API (Application Programming Interface) that lets you fire up jvm.dll with the Windows LoadLibrary() function. Steve Sobolemail Steve Sobol has a project in beta using this approach.

The Assembly Line

It is not hard to write a kicker for one program then compile it. The kicker is totally self contained. But what if you had dozens of them to write. How could you automate the process of creating them so that anyone could do it, even someone with no knowledge of C or MASM ?

One approach would be to write a file describing the kicker (perhaps a simplified bat file), then feed it to your Java program that emits an equivalent C program, execs the compiler, and puts the resulting exe on the path or in the registry. The difficulty here is customising the program to deal with differing C compilers. People who might want to use your kicker might not even own a C compiler or be afraid to install a free one.

So another approach is to write a generic kicker and patch the executable. You could either patch the data in directly into arrays big enough to handle the worst case, or you could patch in the name of a file that had the predigested data in it. You don’t want to have to pass the name of the descriptor file to the kicker on the command line. That would destroy its simplicity and convenience.

You have to be slightly devious in patching an executable to avoid triggering virus detectors. They may freak at any attempt to patch an executable. You have to give your template an innocuous extension, patch it, then rename the result.

Getting Fancy

You can also put preconditions is your kicker, e.g. minimum free disk space before it will launch the real app, must be an Internet connection before it will launch, etc.

You could have kickers that ask questions and use the answers to generate alternate command lines or set parmeters, e.g. to select which printer to use.

You could have kickers that have command line parameters they massage and pass through to the application.

The windows registry entry lets you specify the exe and the default dirctory, but no parameters. You could implement parameterless kickers purely with registry entries in Windows.


This page is posted
on the web at:

http://mindprod.com/project/kicker.html

Optional Replicator mirror
of mindprod.com
on local hard disk J:

J:\mindprod\project\kicker.html
logo
Please the feedback from other visitors, or your own feedback about the site.
Contact Roedy. Please feel free to link to this page without explicit permission.
no blog for this page
IP:[65.110.21.43]
Your face IP:[54.167.10.244]
You are visitor number