kkrzyzak
Posts: 47
Joined: Wed Oct 13, 2010 2:10 pm

Java Service Installation and hidden argument story.

Hi,
I read
Java Service Installation
Service Properties
Service Control Properties
few times beacause i thought that i missed sth but at the end it turned out i wasn't.

I send some arguments to my service using Service Context-> Arguments.

I assumed that i get tab of args that i define in AI. OK.
E.g. I send 3 args => i expected that tab must by also 3 args "tab[3]". NO!!!!!!!!!!
AI add to my tab of args his own arg.
The last arg is : Service Name.

Now i know that tab must be tab[args+1]. <-[SOLVED]

I hope this is helpfull.

Bigest problem for me was that i couldn't find any information about that. I lost some time to figure out what happend.
If This is a bug please fix it. If this is a normal behavior please add note about that to the article.

Best,
Karol.
octavian.vasilovici
Posts: 51
Joined: Tue Jan 25, 2011 2:43 pm

Re: Java Service Installation and hidden argument story.

Hello Karol,
I assumed that i get tab of args that i define in AI. OK.
E.g. I send 3 args => i expected that tab must by also 3 args "tab[3]". NO!!!!!!!!!!
AI add to my tab of args his own arg.
The last arg is : Service Name.
I am afraid I cannot understand what you are trying to say. Can you please be more explicit?
Also, please send us the AIP file to support at advancedinstaller dot com in order to investigate this.


Best Regards,
Octavian
_______________________________________________________________________________________________________________________________________________
Octavian Vasilovici
Advanced Installer Team
http://www.advancedinstaller.com/
Octavian Vasilovici - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
kkrzyzak
Posts: 47
Joined: Wed Oct 13, 2010 2:10 pm

Re: Java Service Installation and hidden argument story.

Hello Octavian,

...In order for a Java application to work correctly as a service you must implement 2 methods in its main class:

One of them is :

Code: Select all

public static void main(String argv[])
{
  // implementation goes here
}
As you can see this method takes parameter, an array of strings.

In article section 7.2 Enter service properties you shows part of the screen that contains the section "Service Context" which contains field "Arguments".

In this field you can enter arguments to be passed as an array of strings to the method main.

And if you provide three arguments in the field "Arguments" the main method receives a string array consisting of four arguments.

My problem was that I expected the main method of three arguments, because I gave three arguments in AI. Unfortunately, AI send 4 arguments and the 4th argument is "ServiceName".

Best Regards,
Karol
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Java Service Installation and hidden argument story.

Hi Karol,

Actually, we are aware of this and an improvement is on our TODO list to be developed and released in a future version.

Best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
mchristianson
Posts: 19
Joined: Sat Jan 10, 2009 1:43 am
Location: Phoenix, USA
Contact: Website

Re: Java Service Installation and hidden argument story.

It's been almost three years, would someone at Caphyon comment and let us know if this has been fixed and in which version?

Thanks
Daniel
Posts: 8279
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Java Service Installation and hidden argument story.

Hello,

First of all we apologize because we've omitted to add an heads up to this thread when this improvement was added.

An improvement regarding this issue was added starting with version 8.9 of Advanced Installer. If you want your java service name to be omitted from the array of arguments, then you should go to "Java Product" page, select your java product and from its "Settings" tab enable the "Omit service name parameter" option under "Application" section.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”