jerrykramskoy
Posts: 3
Joined: Thu Oct 27, 2016 5:51 pm

File extension issues

Hi,

Today I upgraded to AI 13.2.2 (Java installer).

I have created the MSI, and installed (target machine is Windows 10 Pro)... the java app runs fine. The icon for the java app is fine.

But despite setting up a file extension, files with that extension neither show the icon I provided for that prupose, nor does clicking on such files launch my java app ... instead I get the usual "How should this be opened" dialogue.
Capture.PNG
Capture.PNG (6.92 KiB) Viewed 2728 times
Also, can you confirm that, once this is sorted, the name of a clicked file with that file extension will be in the arguments provided to my Java app's main class/method, via the Java app launcher .exe that Advanced Installer generates? Which argument will it be in?

If this isn't the correct mechanism, what is? ... obviously if that file name is unknown to the Java app itself, then having any file extension capability is useless.

Finally, how should the Java app determine the install directory? (Mac and Windows)

Many thanks, Jerry
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: File extension issues

Hello Jerry and thank you for joining to our forums,

This may happen if on target machine there are multiple application registered with your extension. Please note this is the normal Windows behavior starting with Windows 8.

Starting with Windows 8 there is no way to programmatically set the default program for a file extension when there are more application registered for the file extension. This is because Windows decided that this option should be exclusively the user choice. However, the programs you are registering through our "File Associations" page are correctly registered on target system at install time and later on they should be visible in the list with compatible programs to open your file extension. But the user will have to manually set the default program for the file extension.

Please take a look on the "Changes to how Windows 10 handles default apps" section of the linked msdn blog.

If you have any questions just let us know.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jerrykramskoy
Posts: 3
Joined: Thu Oct 27, 2016 5:51 pm

Re: File extension issues

Thanks, Daniel.

The file extension does not come up in the list of applications that can handle it, when trying to open it.

Assuming I fix all this, the improtant question stil remains...

The Java app launcher .exe that Advanced Installer generates gets invoked with an argument folding the name of the clicked file, I believe.

But how does the JVM get hold of that name. I could set a system property (in "JavaProducts>Virtual Mchine") whose value indicates the above-mentioned argument, but what is the correct "value" to use that identifies this argument?

If this isn't the correct mechanism, what is? ... obviously if that file name is unknown to the Java app itself, then having any file extension capability is useless.

Cheers, Jerry
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: File extension issues

Hello Jerry,

I apologize for overlooking your last questions.

Yes, the EXE Java Launcher gets invoked with an argument holding the full path of the launched file. Further on, our Java Launcher passes this argument (the launched file path) in the argument list of the Main() method. So, when the first argument passed to your Main() method is a file with the installed extension you can handle it accordingly.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
jerrykramskoy
Posts: 3
Joined: Thu Oct 27, 2016 5:51 pm

Re: File extension issues

Thanks Daniel. That's what I needed.

Cheers, Jerry
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: File extension issues

You're welcome Jerry.

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

Return to “Building Installers”