sunlight112
16th October 2006 11:39 UTC
How can I check enviroment variable is installed?
In my project, I need to create an environment to set up my application. How can I create script with these requests?
" Right click on My Computer go to the “Advanced†tab and then select “Environment Variables†under “SystemVariables†check if JAVA_HOME is defined. If it isn’t click New and then in the Variable Name type JAVA_HOME and in Variable Value put the location of your Java SDK directory
-Then click New again, and type Variable Name as
MERLIN_HOME and in Variable Value put the location of your merlin directory, which in this case will be “C:\merlinâ€. "
Somebody can help me!!! :)
Thank a lots,
kichik
16th October 2006 11:45 UTC
To read environment variables, use ReadEnvStr. To set them, use one of the solutions available on the wiki.
sunlight112
18th October 2006 11:50 UTC
Thank you for your reply,
I do it well.However,If my environment variable is flexible what will happen?
Eg:
My code :
Section "AddEnvJAVA_HOME"
Push "JAVA_HOME"
Push "C:\Program Files\Java\jdk1.5.0_08"
Call WriteEnvStr
SectionEnd
if user do not install in this directory, how can I know this?
kichik
20th October 2006 09:53 UTC
You can push variables as well. Find out the directory where Java is installed and push that instead of the constant string.
sunlight112
20th October 2006 10:46 UTC
Thank Kichik,
I also think use SearchPath to find directory but I still have problem.
If I use SearchPath.When I search file java.exe, the default path is
"C:\Program Files\Java\jdk1.5.0_08\bin\java.exe"
but I only need
"C:\Program Files\Java\jdk1.5.0_08"
I also look for command to cut string but not this.
I am worry about my searchpath command because file "java.exe" also in directory "C:\Program Files\Java\jre1.5.0_08\bin". So, searchpath will wrong and can not set environment variable.
Can you have another opinion???
kichik
20th October 2006 10:48 UTC
I already answered that in your other thread. Use GetParent.
sunlight112
20th October 2006 11:26 UTC
Thank Kichik