cmjanicki
Posts: 6
Joined: Mon May 18, 2009 1:37 am

Bug: console app behaved badly until rebuilt in AI

My console app tries to read a user's response to list of choices printed to the console. However, when I execute the app via a Windows Command Prompt window, it just returns to the command prompt. No list of choices is displayed, and the app seems to have exited. The command type is "Console" in Advanced Installer.

During testing, I tried your options to redirect System.out and System.err to files. In the System.out file, the list of choices appeared! Why there now, but not the console before? Also I determined from other tests that the app seems to be exiting because the readLine() is returning null, which should only happen at the end of stream, which should never happen to System.in. Instead that call should have blocked until the user pressed "Return".

Also, I noticed that when launching the app by double-clicking on the item in the File Manager, the hourglass would appear for a few seconds, then go back to the normal cursor. During this time, there was no console window opened. All my other console apps open a console window, even if just briefly to display a "usage" message.

At one point later I got desperate and tried to change the name of the app from "Configuration" to "Config". I verified that the "Files and Folders" section and "Java Products" sections both showed the new name. However, when I later looked at the raw AIP file (more desperation) I noticed there there were references to both the old and new name. (Sorry, the file was later changed, so I can't provide more detail.) So something got corrupted.

In the end, I deleted that Java Product, and started from scratch, rebuilding with the same options. This time is worked like all the other console apps.

Bug summary:

1) where did my System.out go?

2) Why didreadLine(() immediately return null instead of blocking for input?

3) Why didn't double-clicking on the app launch a console window?

No need to respond to this in detail, since it's working now. Just want to make sure you are aware of the problem. (I noticed a similar posting from a few years ago regarding a console app that did nothing when run from the command line, but then suddenly worked... maybe related?)
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Bug: console app behaved badly until rebuilt in AI

Hello,
1) where did my System.out go?
I am not sure about this. We would need a sample project to study this behavior.
2) Why didreadLine(() immediately return null instead of blocking for input?
I am not sure how this works in java, but sometimes input buffers need to be flushed, otherwise input functions like readLine simply return data from the input buffer and exit.
3) Why didn't double-clicking on the app launch a console window?
I am not sure about this either. It would have been helpful for us if we still had access to an .aip project file and a sample java app so we could study this behavior.
If you do have any samples that could reproduce this behavior, sending them to support at advancedinstaller dot com would be very helpful.

Regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
cmjanicki
Posts: 6
Joined: Mon May 18, 2009 1:37 am

Re: Bug: console app behaved badly until rebuilt in AI

Gabriel,

Thanks for the quick and thoughtful reply. For what it's worth, I don't think your explanation for #2 fits my case, especially in the light of the other symptoms, but it was an interesting thought. I'll try to do a better job of providing a reproducible scenario for you if/when I see this behavior again.

Thanks,
Chris

Return to “Common Problems”