Command Line Installation of Legacy Java on Mac

There are a few apps which still require the legacy Java to work. If you need to install the legacy Java using command line. Follow these steps.

curl  -Lo javaforosx.dmg  "" 
hdiutil attach javaforosx.dmg 
sudo installer -pkg /Volumes/Java\ for\ OS\ X\ 2015-001/JavaForOSX.pkg -target /
hdiutil detach /Volumes/Java\ for\ OS\ X\ 2015-001/