Jump to content
Sign in to follow this  

Java - Silent Uninstall & Install

Recommended Posts

Hi Again everyone,

my next project is trying to figure out how I can uninstall older version of Java and install the latest version as Me ..

I have this so far , but keep running issues with trying to uninstall the older version I also didnt know if there was a way to run a If statement that if the current version is installed to not continue with the install ..

any advice would be great ..

; Installing Java Verison 6 Update 27.
Global $sUserName = "user"
Global $sPassword = "password"
Global $sNetwork = "domain"
;uninstall java

RunAsWait($sUserName, $sNetwork, $sPassword, 4, "need something help but don't know what" , @SW_Hide)
;Copy Java Install File Over to c:\
;FileCopy("\\server\Java\java.exe", "C:\" ,1)
;install java

;RunAsWait($sUserName, $sNetwork, $sPassword, 4, "c:\Java. /s IEXPLORER=1", @SW_Hide)
;Delete Install File Off c:\

MsgBox(4096, " JaVa Custom Installer ", "  JaVa Has Been Installed ")

Share this post

Link to post
Share on other sites

I also found the following code on a really old post from 2005 , and didn't know if it would help , seeing how i cant get it run ..

;;;variable placeholder

$javavers = ""
$javainst = ""
Global $dirArray[1]
$counter = 0
;;find and evaluate the java installed
$pathprog = @ProgramFilesDir
$dirsearch = FileFindFirstFile($pathprog & "\Java\*")

; Check if the search was successful
If $dirsearch = -1 Then
;;;;no java found at all, will be installed later...
;found java, stick value into array and keep looking
While 1
$file = FileFindNextFile($dirsearch)
If @error Then ExitLoop

;store dir name in array of names.
_ArrayInsert($dirArray, $counter,$file)
$counter = $counter + 1

; Close the search handle
;;;Evaluate current installed Java
;;;sort descending order for eval in select/case

_ArraySort($dirArray, 1)
$counter = 0
For $counter = 0 to UBound($dirArray) - 1
Case String($dirArray[$counter]) = "j2re1.4.2_13"
$javavers = $dirArray[$counter]

Case String($dirArray[$counter]) = "j2re1.4.2_07"
$javavers = $dirArray[$counter]
Case String($dirArray[$counter]) = "j2re1.4.2_03"
$javavers = $dirArray[$counter]

Case Else
;no supported java version is installed, should install java from our install cache, defaulting install variables below.
$javainst = "yes"
$javavers = "j2re1.4.2_13"

$counter = $counter + 1


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...