Why installation from within Stata may not work and how to fix it

1.   The problem

If you are running older versions of Stata (version 13 and older) you may receive the following message:

. net install program_name, from(https://web.stanford.edu/~pmitnik/program_name/)

Remote host closed connection during handshake

https://web.stanford.edu/~pmitnik/program_name/ either

  1)  is not a valid URL, or

  2)  could not be contacted, or

  3)  is not a Stata download site (has no stata.toc file).

r(5100);

This is the likely reason. Stata uses Java for HTTPS connections. However, when Stata attempts to connect to the site the “handshake” fails. When an encrypted connection is attempted, the client (Stata) and the server (stanford.edu) must agree (handshake) on several factors such as the SSLProtocol and SSLCipherSuite that will be used. Older versions of Stata will not have the modern SSL certificates installed and will fail to connect.

2.   How to fix it.

Approach 1. Use the download link provided in the web page to download the program to the folder “…/ado/plus/i/” in your computer or server (the full path is specific to each computer or server, you can find it by typing “adopath” in Stata).

Approach 2. Use the command “set java_vmpath” to tell Stata the path to a "jvm.dll" from a newer Java installation.

Approach 3. Download new certificate files and install them into the Java installed with Stata.

Note: Approaches 2 and 3 will not work with versions of Stata older than Stata 13.