Kumaravel
Posts: 6
Joined: Wed Oct 15, 2008 12:48 am

Java secondaryMain method is not invoked in single instance

I have installer setup as Java single instance application.

I added the following method in the mail class to handle second instance.
static void secondaryMain( String args[] )

I used open verb with file association: "%1"
When I try to run the second instance of the application, the secondaryMain() is not called at all.

I am using 8.0.2 build 31861.
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Java secondaryMain method is not invoked in single insta

Hello,

In order to achieve what you want you should enable the "Single Instance" option from "Java Product Settings" tab.

If you have any questions let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kumaravel
Posts: 6
Joined: Wed Oct 15, 2008 12:48 am

Re: Java secondaryMain method is not invoked in single insta

Thanks for the reply.

Yes. I enabled the [Single Instance] checkbox under Application Type.
But it doesn't work.
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Java secondaryMain method is not invoked in single insta

Hello,

Can you please send us the .AIP (project file) and a download link for your JAR file to support at advancedinstaller dot com so we can test and investigate them?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Java secondaryMain method is not invoked in single insta

Hello Kumaravel,

I just want to update here the resolution for this issue (for future users facing with the same scenario) after our e-mail conversation. It seems the issue appears because your Java application code is obfuscated. When you are using an obfuscation tool you should make sure it doesn't modify your Main or secondaryMain method name or its signature. If it does, then our launcher will not be able to recognize it. So, in order to avoid this behavior you should exclude from obfuscation your Main and secondaryMain method.

Also, if you want to add any useful advices for future users facing with the same scenario please do not hesitate.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rakesh
Posts: 2
Joined: Thu Feb 01, 2018 3:04 pm

Re: Java secondaryMain method is not invoked in single instance

Hi Support Team,

Am facing the same problem, secondary main is not invoked when our java application (.exe) file is running from "Administrator command prompt" first and then starting from normal command prompt. Here second invocation not calling.

Please help as soon as possible.

Regards
Rakesh
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Java secondaryMain method is not invoked in single instance

Hello Rakesh and welcome to our forums,

Unfortunately we do not support this scenario due to the Windows OS design. The OS labels as two different objects the elevated user account context and the non-elevated user account context. Thus we are not able to identify the second launch as being initiated from the same user account.

Maybe we will consider searching for a solution for this scenario in the future, but for the moment I'm afraid there is no workaround.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rakesh
Posts: 2
Joined: Thu Feb 01, 2018 3:04 pm

Re: Java secondaryMain method is not invoked in single instance

Hi Daniel,

Thanks for your reply, please post here if you found any solution or workaround.

Regards
Rakesh
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Java secondaryMain method is not invoked in single instance

You're welcome Rakesh.

When an improvement will be available we will update this thread.

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

Return to “Common Problems”