Check if program is on PATH - 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!

markphip
Posts: 20
Joined: Fri Apr 16, 2010 9:03 pm

Check if program is on PATH

I am installing a service that relies on java.exe being on PATH, which it normally is if the Sun/Oracle JVM is installed. I already check the registry for the version and set the JAVA_HOME environment variable based on what I find if it is not already set. However, on a handful of installations, users have the Sun JVM installed but the EXE is not on PATH. I would like some way to check this so I could add the folder to PATH if it is not there already.

I could easily just always add the JAVA_HOME folder to PATH, but I would prefer not to if possible. If I have to go this route, is AI smart enough to not do this if that folder is already on the PATH?

Normally the JVM does not need to be on PATH because java.exe is in the Windows folders.

Mark
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Check if program is on PATH

Hi Mark,

I am afraid Windows Installer is not able to do this automatically. On the Organization page, create some new component. You can do this by creating a dummy registry key from the registry page.
Now, create your environment variable and place it under the component.
Condition the component using something similar to:

Code: Select all

%path ~>< %java_home
This searches the path for any occurrence of the string in %java_home environment variable. Due to the '~', the search will be case insensitive. Condition will be true only if %java_home is a substring of %path, thus, the component (with the environment variable) will only install then.

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

Return to “Common Problems”