Windows server and Oracle Java updates
Steven Teixeira
steixeira at csustan.edu
Wed Nov 30 16:40:42 EST 2016
I wasn't on the users list at the time this first got posted, so apologies if any of this is off topic. Hope this helps or at least gives a slightly different perspective to someone looking for a solution.
As a Windows Server admin, every time I hear "Java", I shudder...
I'm not sure why every version of Java installs to a folder with the version name instead of to a generic name. There's probably a reason, but it's almost always caused me problems. I suppose symlinks might do it, but I haven't gotten to the point of having to try them. I try not to fight Java and let it do what it wants to do and work around it. Then I curse it when it's not looking.
I was concerned that Java updates might break things(they have more often than not in my limited experience), and I would come into the office one morning to some unwanted surprises. So when I installed the JDK for Shibboleth, I attempted to turn off auto-updating and on a regular basis, I install the JDK updates "manually". Not ideal, but it's better than finding out none of our users can use any services. Maybe I'm just being overly cautious. Scripting the work helps.
We use scripts to deploy things where we are, so if it helps anyone at all, here's the PowerShell script we're currently using. If anyone has any incentive to improve it, please share them back. Since our deployment software runs all of our scripts against our existing servers whenever we make any changes, this script was intended to be able to be used for a brand new server(never had Java installed before) or on our current servers over and over again to achieve a desired install/config. That's why it checks for a specific version of the JDK. Apologies in advance for any formatting problems.
# There are three values in this script that should be changed when upgrading Java versions
# Check to see if the expected version of Java is installed
# It's not good practice to use the Win32_Product class, but it works, so we'll change at some point.
# Change this value to upgrade
$javaCheck = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name -like "Java 8 Update 111*" } | Select-Object -Property Version
if (!$javaCheck) {
# Uninstall any old versions, being sure to stop any running Java dependent processes first or else the server will reboot to complete the uninstall and deployment fails!
if (Get-Service -DisplayName "Shibboleth 3 IdP Daemon" -ErrorAction SilentlyContinue) {Stop-Service -DisplayName "Shibboleth 3 IdP Daemon"}
if (Get-WmiObject Win32_Process | Where {$_.ExecutablePath -like '*Program Files\Java\*'}) {Get-WmiObject Win32_Process | Where {$_.ExecutablePath -like '*Program Files\Java\*'} | Select @{n='Name';e={$_.Name.Split('.')[0]}} | Stop-Process -Force }
# Change this value to upgrade
Get-WmiObject -Class Win32_Product -Filter "name like 'Java%' AND not name like 'Java Auto%' AND not version like '8.0.111%'" | foreach { $_.Uninstall() }
# Install JAVA JDK
Start-Process -FilePath "\\server\share\jdk-8u111-windows-x64.exe" -PassThru -Wait -ArgumentList "/s AUTO_UPDATE=0"
# Set JAVA_HOME environment variable
# Change this value to upgrade
[Environment]::SetEnvironmentVariable("JAVA_HOME", "C:\Program Files\Java\jdk1.8.0_111", "Machine")
}
else {
"Java is already installed. Installed version is: $javaCheck"
}
Steven Teixeira
-----Original Message-----
From: users [mailto:users-bounces at shibboleth.net] On Behalf Of Peter Schober
Sent: Wednesday, November 30, 2016 12:18 PM
To: users at shibboleth.net
Subject: Re: Windows server and Oracle Java updates
* Peter Schober <peter.schober at univie.ac.at> [2016-11-30 21:12]:
> But the link "Server JRE"
> http://www.oracle.com/technetwork/java/javase/downloads/server-jre8-do
> wnloads-2133154.html then gives me a .tgz for MS-Windows (?)
> http://download.oracle.com/otn-pub/java/jdk/8u111-b14/server-jre-8u111
> -windows-x64.tar.gz which that OS knows not how to handle (of course)
> and which their install instructions don't mention: they talk about
> some exe thing I can't find anywhere:
> http://docs.oracle.com/javase/8/docs/technotes/guides/install/install_
> overview.html
> http://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_
> server_jre.html#CFHGHHFJ
>
> So I download 7-zip to extract that gzipped tar and what is the
> content of that "jre" for "windows"? A folder called jdk1.8.0_111,
> which actually seems to contain, well, the JDK?
> Also no sign of javacpl.exe which one is supposed to use to configre
> the auto-updating, which supposedly is in java_home/bin/ (but is not).
At least the instructions here match the behaviour
http://docs.oracle.com/javase/8/docs/technotes/guides/install/windows_server_jre.html#A1097054
"Unpack the tarball and install the Server JRE.
The Server JRE files are installed in a directory called jdk1.8.0_version in the current directory."
So both tar and a folder called jdk are to be expexted (the former obviously to annoy MS-Windows users, which I can sympathize with, the latter to mess with everyone, seemingly).
No idea how the auto-update is supposed to happen then, but I'll leave that for another time.
-peter
--
To unsubscribe from this list send an email to users-unsubscribe at shibboleth.net
More information about the users
mailing list