9 Replies Latest reply on Jan 21, 2014 12:35 PM by marcel

    Installing Java on Windows 7

    jlschmidt Rookie

      I have run across a problem installing Java 6 Update 22 on to Windows 7 via Software Distribution.  Our users are for the most part standard users and do not have admin rights on their machines.  When creating the distribution package in Landesk we user the Local System Account to install the software.  When deploying to machines the installation fails.  For some reason it seems the Local System Account is unable to extract the installation media to the following location.

       

      C:\windows\system32\config\systemprofile\AppData\LocalLow\Sun\Java\jre1.6.0_22\

       

      If i switch to Current user and log on with an administrative account it installs fine.

        • 1. Re: Installing Java on Windows 7
          ahe Expert

          How did you deploy it? Is it a installation from source or did you copy the package locally and start it from the local disk?

           

          Which deployment method did you use?

          Do you create a EXE or a MSI distribution package?

          Do you created a own scripted installation procedure (VBS, Batch, AutoIT)?

           

          regards

          Axel

          • 2. Re: Installing Java on Windows 7
            jlschmidt Rookie

            I am seeding all installation media to the local computer.  Then we call the vendors .exe file with the silent switches to install it without user interaction.

             

            The issue seems to be coming from the vendor .exe expanding files to C:\windows\system32\config\systemprofile\AppData\LocalLow\Sun\Java\jre1.6.0_22\.  For some reason when the install is run with the Local System Account is getting an access denied error.  If I run the install with an administrative account through Landesk it installs just fine.

            • 3. Re: Installing Java on Windows 7
              mrspike SSMMVPGroup

              Are you install the actual Java, or a vendors package that contains Java?

               

              Another thing you can do it extract the msi & data.cab and run this:

               

              \\path\jre1.6.0_26.msi

               

              Use this as an install option... actually you may not want the /qn and i think LANDesk does that for you, but test.

              /qn ADDLOCAL=ALL SYSTRAY=0 EULA=0 JAVAUPDATE=0 AUTOUPDATECHECK=0 JU=0 REBOOT=ReallySupress

              • 4. Re: Installing Java on Windows 7
                Specialist

                So... I just did this for "Java(TM) 6 Update 21"

                 

                Here's what I did.

                 

                First, I extracted the the "jre1.6.0_21.msi" and "Data1.cab" by starting the install and grabbing the two files, and canceling the install.

                 

                I created a BATCH distribution package that used the attached BAT file.

                 

                I included the "JavaUninstallScript.vbs", as well as the two files mentioned above in the package.

                 

                Now... here's some things you need to know.

                 

                The vbscript will uninstall all previous versions unless you specify specific ones in the command line.  I modified the script to uninstall all versions, except Update 21, and if Update 21 is not installed, it'll install it silently for me.

                 

                Here are the command line functions for the vbscript.

                 

                Java Runtime Environment Removal Script v3.0

                 

                Removes Java runtimes based on command line parameters.
                Default parameters removes all Java versions without creating logs.
                Does not uninstall Java versions 1.3.0_05 and 1.3.1_05 through 1.3.1_20.
                They do not uninstall silently.

                 

                Command line switches:

                 

                /keeponly  Script keeps only versions specified.
                   If no versions are specified no versions are kept.

                 

                /removeonly  Script removes only versions specified.
                   If no versions are specified no versions are removed.

                 

                /versions:  Specifies verions to act on.
                   Versions are seperated by semicolons.
                   By default specified versions are kept.
                   MUST MATCH THE DISPLAY NAME IN ADD/REMOVE PROGRAMS

                 

                /versionsx86onx64: Specifies x86 runtime versions to keep on a x64 system.
                   Versions are seperated by semicolon.
                   If no x86 versions are specified script uses versions
                   specified by /versions for both x64 and x86 runtimes.
                   MUST MATCH THE DISPLAY NAME IN ADD/REMOVE PROGRAMS

                 

                /logfilepath:  Sets path for uninstall log file from Java runtimes.
                   If path does not exist uninstallers will fail.

                 

                Examples:

                 

                cscript /nologo JavaUninstallScript.vbs /keeponly /versions:"Java(TM) 6 Update 24;J2SE Runtime Environment 5.0 Update 16" /logfilepath:"C:\Temp"
                Removes all Java Runtimes found except Java 6 Update 24 and J2SE 5 Update 16 and places the uninstall logs in C:\Temp.

                 

                cscript /nologo JavaUninstallScript.vbs /keeponly /versions:"Java(TM) 6 Update 24" /versionsx86onx64:"J2SE Runtime Environment 5.0 Update 16" /logfilepath:"C:\Temp"
                Removes all Java Runtimes found except x64 Java 6 Update 24 and x86 J2SE 5 Update 16 on a x64 system and places the uninstall logs in C:\Temp.

                 

                cscript /nologo JavaUninstallScript.vbs /keeponly
                Removes all Java Runtimes without creating logs.

                 

                cscript /nologo JavaUninstallScript.vbs /removeonly
                Keeps all Java Runtimes. Only useful for making a list of installed runtimes.

                 

                Here's the batch file, modify the red if you want to keep a specific version only, but remove all others.

                 

                MD C:\Temp\Java
                cscript /nologo JavaUninstallScript.vbs /keeponly /versions:"Java(TM) 6 Update 21" /logfilepath:"C:\Temp\Java" >> "C:\Temp\Java\JavaUninstallLog.txt"

                 

                If you want to use a version other than 21, modify these lines in the vbscript.

                 

                strIntendedVersion = "Java(TM) 6 Update 21"

                 

                strInstallString = "msiexec.exe /i jre1.6.0_21\jre1.6.0_21.msi /quiet /norestart STATIC=1"

                 

                I also modified the script to notify LANDesk via SDClient.

                 

                I'm sure I didn't post enough info, so if you have any questions let me know.

                 

                Chris

                • 5. Re: Installing Java on Windows 7
                  Specialist

                  And the reason the installation is failing with the system account instead of the local user is because Java's installer is broken and when it extracts the files it doesn't know how to find them.  A real big issue with Win7 x64, and sometimes in the 32bit version.

                   

                  The solution I found on various sites was to grab the MSI and the CAB file that are extracted when you start the install manually.  The files are found once you begin the installation in the "%userprofile%\AppData\LocalLow\Sun\Java\<java version>" folder.

                   

                  Now that you have the MSI and CAB files, use msiexec to install Java.

                   

                  Example command: msiexec.exe /i <java version>.msi /quiet /norestart STATIC=1

                   

                  (be sure to include the CAB file in the distribution package)

                   

                  Hope that helps.

                  • 6. Re: Installing Java on Windows 7
                    jlschmidt Rookie

                    All awesome stuff here.  I was speaking about this issue with our Microsoft rep that is onsite and he sent me a link that cleared my issue up.  Here is the link and the issue that seems to have been causing my problem.

                     

                    "\Using procmon I found it was getting this path -
                    %systemroot%\system32\config\systemprofile from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-18. Likewise there is a similar key HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\ProfileList\S-1-5-18 which is also set to %systemroot%\system32\config\systemprofile. If I set the wow6432node one to %systemroot%\syswow64\config\systemprofile instead, then the Java installer runs as the SYSTEM account. I'll do more testing, but more is welcome.

                     

                    The reason it works for a user is the profileimagepath is set to the C:\users\<username> folder for both the 32 & 64-bit registry bits.

                     

                    http://www.myitforum.com/forums/m215451-print.aspx"

                     

                    What I ended up doing was during my installation I edited the registry key as listed above and then post install undo my changes so it is back to normal.

                    • 7. Re: Installing Java on Windows 7
                      jcmachadouga Apprentice

                      Thanks a lot DataSpike!

                       

                      Your post helped me getting rid of all those OLD java installs !

                      • 8. Re: Installing Java on Windows 7
                        IHGkbraun Apprentice

                        Had to dig up an old thread.

                         

                        I was able to set this up as perscribed, but the issue I am having is now that I have changed the .vbs it uninstalls the verion I have installed I want to keep, 7_45.

                        Currently 7u45 is the latest and it will remove it (and successfully removes 6) and fail to (re)install 7_45.

                         

                        Win7x64

                        I have downloaded the msi and cab files and running in the same dir.

                        Currently running it locally (tried admin as well) to test and gets a 1619 Java install error.

                         

                        I can't manually install it at this point in my environment until I can get 7u45 to remain/be installed if not found.

                         

                        Not super talented at coding, wondering how I could have changed the vbs script THAT much.

                         

                        Any chance on an update for 7u45 DataSpike?    

                         

                        (working on attaching log files if i can them to this device)

                        • 9. Re: Installing Java on Windows 7
                          marcel Specialist

                          We are using Autoit in our deployment and use a simple uninstall func for all msi related products by calling a windows internal function (wmic)

                           

                          ; General Uninstall function

                          func _uninstall($name)

                            

                             Local $foo = Run("WMIC.exe product where ""name like '" & $name & "'"" call uninstall","",@SW_HIDE,$STDOUT_CHILD)

                             Local $line

                             While 1

                                       $line &= StdoutRead($foo)

                                       If @error Then ExitLoop

                                               

                                               

                                       if stringinstr($line,"ReturnValue") then

                                               

                                               $Identifier = stringmid($line,stringinstr($line,"{"),38)

                                               $Name = stringmid($line,stringinstr($line,"Name=")+6,stringinstr($line,"Version=")-stringinstr($line,"Name=")-8)

                                               $Version = stringmid($line,stringinstr($line,"Version=")+9,stringinstr($line,")->")-stringinstr($line,"Version=")-10)

                                               $Value = stringmid($line,stringinstr($line,"ReturnValue = ")+14,stringinstr($line,";")-stringinstr($line,"ReturnValue = ")-14)

                           

                           

                                               $line = ""

                                               $log = $Identifier & "-" & $Name & "-" & $Version & "-" & $Value

                                              

                                               return $Value

                                               

                                       EndIf

                                      

                                       if stringinstr($line,"Keine Instanz") then

                                               

                                                return 0

                                               

                                       EndIf

                                      

                                    Wend

                           

                          EndFunc

                           

                           

                           

                           

                          DirCreate("c:\LDTemp\")

                          FileInstall("Data1.cab", "c:\LDTemp\",1)

                          FileInstall("jre1.7.0_45.msi", "c:\LDTemp\",1)

                          FileInstall("jre1031.MST", "c:\LDTemp\",1)

                           

                           

                           

                           

                          _uninstall("%Java 6%")

                          $error = 0

                          $error = RunWait("msiexec /i jre1.7.0_45.msi /qn /norestart", "c:\LDTemp", @SW_HIDE)

                           

                           

                           

                           

                          ; Disable JavaAutoUpdate

                          RegWrite("HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy", "EnableJavaUpdate", "REG_DWORD", 0)

                          RegWrite("HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy", "NotifyInstall", "REG_DWORD", 0)

                          RegWrite("HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy", "NotifyDownload", "REG_DWORD", 0)

                          RegWrite("HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy", "UpdateSchedule", "REG_DWORD", 0)

                           

                           

                           

                           

                          DirRemove("c:\LDTemp",1)

                           

                           

                           

                           

                          Exit $error