title: In Java, what is the simplest way to create an SSLContext with just a PEM file?
body: <p>I used LetsEncrypt's CertBot to generate PEM files for free.  In other languages it is easy to start an HTTPS server using just a couple lines of code and the PEM/key files.  The solutions I have found so far in java are overly complex and I'm looking for something simpler.</p>
  
  <ol>
  <li>I do not want to use java's command-line "keytool".  I just want to drag and drop my PEM/key files into my eclipse, and programatically start up an HTTPS server using an SSLContext.</li>
  <li>I do not want to include massive external libraries like BouncyCastle. See the following link for a supposed solution using BouncyCastle:  <a href="https://stackoverflow.com/questions/42675033/how-to-build-a-sslsocketfactory-from-pem-certificate-and-key-without-converting?rq=1">How to build a SSLSocketFactory from PEM certificate and key without converting to keystore?</a></li>
  </ol>
  
  <p>Is there a better/easier way to do this?</p>