From command line download latest Java SE Runtime Environment 8 on Windows

半腔热情 提交于 2021-02-16 19:53:14

问题


On a Windows server, I am looking for a robust way to download latest Java SE Runtimes from command-line .

My requirement is to check if java is installed on the system. If java is not found, our MSI installer (created with WIX) need to connect oracle java download page and silently download java installer in the background and invoke the installer silently. Download option can be in VB script/PowerShell/batch/Java

Installing java silently is easy with jre-8u121-windows-x64.exe /soption.

I could find couple of solutions to download jre on *nix with curl/wget from this post

However, couldn't find any robust solution on Windows.

Please let me know is there a fool proof way to download JRE installer on Windows from command line.


回答1:


I'd go with chocolatey, its simple, easy and handles all the pain for you (like keeping up with the new versions or when the link changes, etc)




回答2:


cmd.exe /c "MD C:\Install-temp&bitsadmin /transfer Download /download /priority high https://javadl.oracle.com/webapps/download/AutoDL?BundleId=236886_42970487e3af4f5aa5bca3f542482c60 c:\Install-temp\Java.exe&start /wait c:\Install-temp\Java.exe /s & RD c:\Install-temp /S /Q"



来源:https://stackoverflow.com/questions/43704512/from-command-line-download-latest-java-se-runtime-environment-8-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!