problems with java "hide settings" option - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

problems with java "hide settings" option

Hello,

I'm using AI 7.6 build 27499

I am experiencing inconsistent / incorrect handling of arguments when my settings are inside the INI versus inside the native launcher EXE.

==================== . Configuration 1 . ====================

Java Products > Virtual Machine

Code: Select all

Command Line: "%APPDATA%\[Manufacturer]\[ProductName]\data"
Output Stream to: "[logs_DIR]%USERNAME%-output.log"
Error Stream to: "[logs_DIR]%USERNAME%-error.log"
[logs_DIR] is a folder I create at install time, which points to "Common Application Data/[Manufacturer]/[ProductName]/logs". I am redirecting the logs to that folder as I was advised in one of my other posts.

After I build and install the product, the relevant part of the INI file looks like this:

Code: Select all

[Application]
Cmd=""%APPDATA%\MyCompany\My New Product\data""
Application Type=gui
Failure Check=yes
Single Instance=yes
Output File="C:\Documents and Settings\All Users\Application Data\MyCompany\My New Product\logs\%USERNAME%-output.log"
Error File="C:\Documents and Settings\All Users\Application Data\MyCompany\My New Product\logs\%USERNAME%-error.log"
When I run my java application, I receive the entire value of the "Cmd" arg as the first and only element in my String array:

Code: Select all

public static void main (String[] args)
That is the correct behavior - the value of Cmd is a path, which I have double-quoted to indicate that it should be treated as a single argument when passed to my java application.

During install, I create the path [logs_DIR] for the stream redirection logs. When the app runs, the out/err streams are correctly redirected to the files inside [logs_DIR].


==================== . Configuration 2 . ====================

Java Products > Settings > select the "Hide Settings" checkbox

After I rebuild and install, I see that the INI file does not contain an "Application" section any more; this is expected, as those settings should now be contained within the EXE native launcher.

Now when I run my application,

*** Cmd ***
- I receive the value of the "Cmd" argument as a String array with multiple elements - the path is not properly quoted, so java treats each whitespace char as a new command-line argument.

- Additionally, the values of [Manufacturer] and [ProductName] have not been replaced with the appropriate string - they are passed as the string literals "[Manufacturer]" and "[ProductName]".

- The String array that is given to my application is:
  • C:\Documents
  • and
  • Settings\toddpatt\Application
  • Data\[Manufacturer]\[ProductName]\data""
- Yes, the trailing quote-quote sequence is actually passed as part of the String element - that is not a typo that I made.

*** Logs ***
- The redirect logs are not written to the [logs_DIR]. I cannot find them anywhere on the file-system, so presumable they are not being created because of path-related problems.

- If I remove the enclosing quotes from around the out / err paths, rebuild and install, the logs are then created.


==================== . Summary . ====================

*** Logs ***
The handling of enclosing quotes around the out / err paths is inconsistent.
- If the settings are contained in the INI file, the presence or absence of enclosing quotes does not matter - both ways will succeed.
- If the settings are contained in the EXE file, the presence of enclosing quotes prevents the creation of the logs. The logs will only be created if the enclosing quotes are removed.

It would be cleaner if the behavior were consistent.

*** Cmd ***
- Enclosing quotes are not handled properly when settings are stored in the EXE file.
- Properties / variables in the "Command Line" field are only resolved if the settings are stored in the INI file. When the settings are stored in the EXE, the properties / variables are never resolved.


Thanks for your help,
-Todd
Last edited by toddpatt on Sat May 08, 2010 1:19 am, edited 1 time in total.
toddpatt
Posts: 111
Joined: Fri Jan 08, 2010 1:36 am

Re: problems with java "hide settings" option

I edited the original post with more accurate info (did some additional testing).

fyi,
-Todd
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: problems with java "hide settings" option

Hi Todd,

Thank you for bringing this to our attention.
Indeed you are correct, there is a problem with quotes and the enabled Hide option, we will fix this in a future version of Advanced Installer.
In the meantime, you can do the following:
- in the Command field, use the values themselves instead of using '[Manufacturer]' or '[Productname]' and do not use quotes
- in the stream redirection field do not use quotes

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”