Search for Java_home as dependancy
I have a SAP application that requires Java. As usual it came as a .exe so I've done a snapshot of the SAP install into MSI. During installation it does a check for Java and stores the "Java Home" folder (c:\programfiles\java\jre6 ect) it detects in the configuration file to run SAP. The SAP configuration file post install/snapshot specifies the Java version I had on the snapshot machine.
eg:
@echo off
set JAVA_HOME=C:\Program Files\Java\jre6
set JAVA=%JAVA_HOME%\bin\java.exe
I need the MSI to somehow to detect java version on install pc. I would like to use the JAVA_HOME variable but its not actually in the SET list.
Any ideas?
eg:
@echo off
set JAVA_HOME=C:\Program Files\Java\jre6
set JAVA=%JAVA_HOME%\bin\java.exe
I need the MSI to somehow to detect java version on install pc. I would like to use the JAVA_HOME variable but its not actually in the SET list.
Any ideas?
0 Comments
[ + ] Show comments
Answers (11)
Please log in to answer
Posted by:
icbrkr
13 years ago
Posted by:
Micka007
13 years ago
Posted by:
dunnpy
13 years ago
You could decide on a version of Java to go with SAP and deploy together - thus negating the need to search for the specific version as you control the installation of both and define the paths for the correct Java version.
The other option would be use a System Search within your MSI to find the Java path (either from a file path or a key in the registry) and store them as a public property which you could then use to write back to the configuration file as necessary.
Hope that points you in the right direction,
Dunnpy
The other option would be use a System Search within your MSI to find the Java path (either from a file path or a key in the registry) and store them as a public property which you could then use to write back to the configuration file as necessary.
Hope that points you in the right direction,
Dunnpy
Posted by:
anonymous_9363
13 years ago
The problem with AppSearch for JRE in this case is that there is no central place that one can use to divine the path without parsing the resulting data or walking a registry branch. For example, the path for 1.6 is held in HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment\1.6\JavaHome. Equally, you might think you could search for JAVAW.EXE. You can, but it's in 'C:\Program Files\Java\jre6\bin'.
Either way, to populate the file location which the OP wants requires stripping out unwanted data.
Either way, to populate the file location which the OP wants requires stripping out unwanted data.
Posted by:
Micka007
13 years ago
Posted by:
dunnpy
13 years ago
Posted by:
Micka007
13 years ago
Posted by:
Micka007
13 years ago
Posted by:
anonymous_9363
13 years ago
Do you know how the SAP.exe would [of] have performed this searchNo, I'm afraid I don't but almost certainly one (or both) of the methods I outlined. You could build a script and have it set a property which your package could then use. There are many, many examples of folder-walking scripts around. Use one of those, add the property-setting code to it and include it as a Custom Action in your MSI.
Posted by:
Micka007
13 years ago
Please forgive, I'm not that great at scripting. I was thinking of using the following which lists JavaHome and other keys/values but how do I extract the value for JavaHome? or can I do a search specifically for the JavaHome value without knowing the complete path?
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" /s
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Runtime Environment" /s
Posted by:
anonymous_9363
13 years ago
how do I extract the value for JavaHome? or can I do a search specifically for the JavaHome value without knowing the complete path?That was kind of my point.
Forget the registry for now. The scripts I've found for walking registry keys are, on the whole, to be avoided. I use the cRegistry class from JSWare in my scripts but that's a bit scary for newcomers.
Find a script that walks a folder to find a file. In your case, that file will be JAVAW.EXE. Trap the name of the containing folder, then use the .ParentFolder property to get the name of the folder one level up. Then use Session.Property to set the value of your public property. Then use THAT property to set whatever configuration the app requires.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.