Site Sponsors:
EzLog4J 3.01 

It's About Time

Anyone who develops software in their spare time knows that the choice over how to spend that time is often budgeted between re-testing, or adding cool features.

Testing Word

Indeed, as we consider how tighter security is causing many programs to fail on Microsoft Windows, the word on the street for anyone who has not tested their programs in the past 3 months should be to do so - and to test across as many OS flavors as possible.

Crazy Problems!

Once Java has been installed on your computer, EzLog4J was designed to run from a simple click. Since our latest install of 'Windows 7 with the Oracle 7 platform-invocation randomly decided to use WebStart (!), a clicking on ezlog.jar thereunder fails with a JNLP Error.

Oddly, the new default is to use WebStart. From there, to treat Java as hostile even on your own local machine.

In other words, without even the slightest hint of any web-start support requested in the .jar file, if your Java Application is not code-signed, then it will no longer run on Microsoft Windows! Even worse, Oracle insists that self-signed code will shortly be going the way of the Dodo.


Yes, we could educate all would-be users how to do an "open with" to run our .jar files with some other launcher, but fortunately there are several simple work-arounds. Techniques that we developers can take to effectively side-step this ever-growing .jar lock-down problem.

For lack of time, we employed the easiest of the lock-down avoidance lot -- batch files & "start" commands:

cd .\dist
start javaw -jar ezlog3.jar

~ or ~

cd .\dist
java -jar ezlog3.jar

How does the alternate file-name approach work? -Well, since most folks ignore those file types / descriptions on Microsoft Windows ANYway, my friends will still "start" my program by clicking on the "ezlog.bat", rather than that evil "ezlog.jar" file. --All anyone will be looking for is to click on the word "ezlog" anyways. (Muhhhahah-ha)

The .EXE End?

What comes next? Rather than brandishing console-laden command prompts everywhere, everyone who does not want to pay $100 / month for a certificate will surely be creating an .EXE, next (which the planetary-wide free Java Tooling - at the time of this writing - will not create!)

--Might all of the above .jar lock-down silliness be more evidence that Oracle is indeed trying to kill Java?


So because 'Windows accounts for about 80% of the EzLog4J Project downloads, last night we provided a new ezlog.bat start-up file. To run EzLog4J on 'Windows, merely merely download & unpack the zip file from SourceForge to click on the same from within The Microsoft Windows File Manager.

In a like manner, Linux & OS X Users can try the virtues of the included file.


Along the way, we discovered & fixed a voice-file playback buglet, as well. -Hence the .01 suffix on this Version 3-Release.

(Perhaps Nietzsche was right: That which does not kill us, makes us stronger?)

[ view entry ] ( 3433 views )   |  permalink  |  related link
Gracefull Java Inter-Process Communications (IPC) 
After reading yesterday's article, those who remain curious over how to properly manage IPC on Windows & POSIX might enjoy our new, simple, Framework. (Note that the source code is included in the download / jar file.)

"The IpcStringReader Class will monitor the results from an executing process so as to:

(1) Present lines-read to a collector line-by-line.

(2) Keep from hanging-up when a process fails and

(3) Allow us to gracefully accept and / or terminate our result line-reading activities when desired.

Designed to quickly & efficiently manage the result from one or many concurrently running (IPC) Processes, see the test cases for examples on how to use this Package."

NOTE: The test cases in this Package also demonstrate how to use the java.util.concurrent.ExecutorService tooling.

IpcReader Project

[ view entry ] ( 2561 views )   |  permalink  |  related link
Java IPC and Microsoft Windows 
Since the 1970s, folks in the C World have long been enjoying the benefits of "piping" things between processes. Piping is easy, it is fun, and (with a single invocation work-around on Microsoft Windows) piping works pretty much the same everywhere.

While we have been able to start, read, and pass information to other programs on Java for awhile now, everyone knows that - far from "Write Once, Run Anywhere", using Processes under Java can be a very platform – let alone operating system process - specific undertaking.

Process Woes

Interestingly, the first cross-platform IPC problem has very little to do with Java. When working on 'Windows, the most frequent errors encountered often simply have to do with (1) where the program is located / invoked, as well as (2) how we use Java to manage the input and output streams.

Location Matters

For those who are new to programming, the first thing to do is to note that some of the commands we use at a terminal (or "shell") are built-in. Others are external. Hence whenever we type "ls" on Linux, or "DIR" on Microsoft Windows we are not executing an external command. What we are instead doing is executing a built-in ''shell'' feature.

Command-Line Parsing

Unlike our single space-separated string convention on POSIX, Microsoft Windows expects commands to be passed to its command shell via a series of strings. In this way, Java and C/C++ have the same requirement on 'Windows. Both exec() a command shell under the same constraint.

After the obvious however, the second problem begins to bear its teeth: when reading input from a stream on Java, unlike in C/C++ there is no “putc” or “push_bask” capability. Hence, anti-blocking stream pre-read / put_back testing is not possible. We must use .ready(), instead.

What's wrong with using a Reader's “ready()” feature, you might ask?

Well, to begin with, most folks do not use it. --Indeed, whenever ready() is used, rather than simply a “put back” ability, crafting clever “look ahead” and / or time-out checking loops require a block or two more code. (see below)

Reading CMD.EXE Responses under Java

So after the common Windows invocation differences, forever-blocking on any type of buffered / un-buffered read is often the next problem to tackle.

Unlike the former Windows invocation problem however, our second problem is common on POSIX, as well. Our common solution is that in Java, before we read a shared IPC Stream, we had better check to see if it is ready(). Why? Because not only can streams go cross-platform 'zombie on us during even an un-buffered read, but trying to fix the problem – along with dodging common threading problems - might just eat our brain :-)


public class ProcOne {

static int BY_LOOP = 7;

public static void main(String[] args) {
try {
String[] data = { "CMD.EXE", "/C", "DIR", ".." };
Process proc1 = Runtime.getRuntime().exec(data);
InputStreamReader is = new InputStreamReader(proc1.getInputStream());
int ch = 0;
do {
int times = 0;
while (is.ready() == false) {
if (times > BY_LOOP) {
if(times > BY_LOOP)
ch =;
if(ch != 0)
} while(ch != 0);
} catch (Exception e) {


If you have any doubt, then (2) remove the IO Checking Block then (1) merely change data in the above to a single String: "CMD.EXE /C DIR .." Finally, before debugging (0) pretend you never saw this post & go grab your next-door neighbours shotgun ...

Enjoy the Journey!

(p.s. - Later that evening we encapsulated the above concepts into a simple-to-use Framework. The design allows us to incorporate the events from one - or hundreds - of clustered (cloistered?) IPC Activities into a graphical / textual user interface (GUI/TUI.) See the IpcReader Project on SourceForge for more information.)

[ view entry ] ( 2335 views )   |  permalink  |  related link

<<First <Back | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | Next> Last>>