pstrooij
Posts: 8
Joined: Wed Nov 16, 2011 3:43 pm

Environment variables Java6/7

Hello,

I am building a new installer for our application. Our customers are using Java6 and Java7. I need to have the installer to set an environment variable dependent of the used Java version:

If Java 6 is installed the installer needs to set an environment variable as xxxxx
If Java 7 is installed the installer needs to set this environment variable as yyyyy

Is this possible to do within 1 installer? If so, how?

Thanks for your answers.
Eusebiu
Posts: 4959
Joined: Wed Nov 14, 2012 2:04 pm

Re: Environment variables Java6/7

Hi,

In order to achieve what you want you can follow the steps below:
- go in the Search page and create a "File version" search using the [Extended Search] toolbar button and write the path to the file in the "File to find" text field (you can rename the search property i.e. JAVA_VER)
- go in the Install Parameters page and create a new property (i.e. MY_PROP) and in the "Value" text field write xxxxx
- go in the Custom Actions page, create a "Set installer property" custom action with sequence, place it under "Wizard Dialogs Stage -> Searches" action group and use the following settings:
  • Property: MY_PROP
    Formatted: yyyyy
    Condition: JAVA_VER >= "7"
- go in the Environment page, create a new environment variable and in the "Value" text field write [MY_PROP] property
- build and run the project

Let us know if this helped, otherwise give us more details about your scenario.

Best regards,
Eusebiu
Eusebiu Aria - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”