Java in Windows

https://docs.oracle.com/javase/7/docs/technotes/guides/jweb/jcp/properties.html

Java hat immer unterschiedliche Programmpfade.
Deshalb kann man so über die Registry herausfinden, wo die aktuelle Javaversion installiert ist:

getjavapath.ps1
$javahome = gci HKLM:\Software\JavaSoft -rec -ea SilentlyContinue | `
        % { if((get-itemproperty -Path $_.PsPath) -match "JavaHome") { $_.PsPath} } | `
        Get-ItemProperty| select-Object -last 1 | ft -HideTableHeader JavaHome | out-String 
echo $javahome

Standardmäßig sind bei einer neuen Javaversion die allgemeinen Konfigurationen hier hinterlegt:
C:\Windows\Sun\Java\Deployment\deployment.properties
Darüber werden auch die Registryinformationen gesteuert und immer wieder zurückgesetzt, wenn geändert.
HKCU\Software\JavaSoft\DeploymentProperties

Siteausnahmen für Benutzer konfigurieren

manuelle Einträge in Datei: C:\Users\benutzer\AppData\LocalLow\Sun\Java\Deployment\deployment.properties
bzw.
manuelle Einträge in Datei: C:\windows\Sun\Java\Deployment\deployment.properties

deployment.user.security.exception.sites=C\:\\Users\\benutzer\\AppData\\LocalLow\\Sun\\Java\\Deployment\\security\\exception.sites
deployment.user.security.trusted.certs=C\:\\Users\\benutzer\\AppData\\LocalLow\\Sun\\Java\\Deployment\\security\\trusted.certs
deployment.user.security.trusted.cacerts=C\:\\Users\\benutzer\\AppData\\LocalLow\\Sun\\Java\\Deployment\\security\\trusted.cacerts

Wenn in der o.g. Datei nichts spezielles für Benutzer eingetragen ist, wird hier nach Seiten-Ausnahmen gesucht:
%userprofile%\AppData\LocalLow\Sun\Java\Deployment\security\exception.sites

writeJavaExceptionlist.ps1
################################################################################
# writejavaexceptionlist.ps1 -excpt http://mytomcatsrv:8080
# java-exceptiondatei auslesen und eintrag für tomcatserver einfügen /rb 2019
################################################################################
#$ErrorActionPreference= 'silentlycontinue'
param(
[string]$excpt
)
$esites = "$Env:USERPROFILE\AppData\LocalLow\Sun\Java\Deployment\security\exception.sites"
$content = Get-Content $esites
 
If (!(Test-Path $esites))
{echo "file not exist"
New-Item -path $esites
echo $excpt |Out-file -append $esites #-NoNewline
}
If (($content).Contains($excpt))
{
    #write-host "$excpt found in $esites"
    break;
}
else {
    #write-host "$excpt not found in $esites"
    Add-Content -path $esites -Value $nl$excpt #-NoNewline
    ##CRLF aus Datei löschen wenn vorhanden
    (gc $esites) | ? {$_.trim() -ne "" } | set-content $esites
    }
################################################################################

Siteausnahmen für das ganze System konfigurieren

Datei c:\windows\sun\Java\Deployment\exception.sites erstellen und editieren

Zertifikate in lokalen Client-Javastore importieren

setJavaCerts.ps1
################################################################################
#setJacaCerts.ps1 -certfile \\mydom\netlogon\certs\mycert.crt -alias mytomcat 
#installiere ein Zertifikat in den Javastore des Benutzers / rb /2019
################################################################################
param(
[string]$certfile,
[string]$alias
)
$keystore = $env:USERPROFILE + "\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs"
$javahome = gci HKLM:\Software\JavaSoft -rec -ea SilentlyContinue | `
        % { if((get-itemproperty -Path $_.PsPath) -match "JavaHome") { $_.PsPath} } | `
        Get-ItemProperty| select-Object -last 1 | ft -HideTableHeader JavaHome | out-String 
$keytoolpath = $javahome.Trim()+"\bin\keytool.exe"
Start-Process -FilePath "$keytoolpath" -ArgumentList '-importcert',"-alias $alias","-file $certfile",`
'-storepass mypassw0rd','-noprompt',"-keystore $keystore" -NoNewWindow
################################################################################

Zertifikate in cmd auflisten:

"c:\Program Files (x86)\Java\jre1.8.0_202\bin\keytool.exe" -list -storepass mypassw0rd -keystore c:\users\username\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs

Zertifikat manuell wieder löschen:

"c:\Program Files (x86)\Java\jre1.8.0_202\bin\keytool.exe" -delete -alias mytomcat -storepass mypassw0rd -keystore c:\users\username\AppData\LocalLow\Sun\Java\Deployment\security\trusted.certs


Das Konfigurieren in der Systemsteurung ändert nur Einstellungen der 64-Bit-Version.
Die 32-Bit-Version muss manuell konfiguriert werden.

Proxy in Java ändern

Datei C:\Users\benutzername\AppData\LocalLow\Sun\Java\Deployment\Deployment.properties ändern:

Proxy direkt:

deployment.proxy.type=0

Proxy per wpad:

deployment.proxy.type=2
deployment.proxy.auto.config.url=http://wpad/wpad.dat