title: Ssl handshake fails with unable to find valid certification path to requested target
body: <p>First of all, I know this was asked before but I'e tried the solutions proposed and got no results. </p>
  
  <p>I'm trying to develop a simple program in java where it connects to a website and reads from a text file hosted there. At first I thought the certificate would cause problems because I can't open the website on firefox without receiving a warning. Internet explorer doesn't create any issue. The code is the following: </p>
  
  <pre><code>import java.io.BufferedReader;
  import java.io.FileInputStream;
  import java.io.FileNotFoundException;
  import java.io.IOException;
  import java.io.InputStreamReader;
  import java.io.UnsupportedEncodingException;
  import java.net.*;
  
  public class insig
  {
      public static void main(String[] args) throws IOException
      {
          URL fpath           = new URL("website/test.txt");
          BufferedReader br   = new BufferedReader(new InputStreamReader(fpath.openStream()));
  
          String Reader = null;
  
          while((Reader = br.readLine()) != null)
          {
              System.out.println(Reader);
          }
      }
  }
  </code></pre>
  
  <p>The first thing I tried was the solution presented on <a href="https://stackoverflow.com/questions/6908948/java-sun-security-provider-certpath-suncertpathbuilderexception-unable-to-find">Java: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target</a>, with no sucess. Tried to debug, and although I do not understand this really well, with the help of this <a href="http://docs.oracle.com/javase/1.5.0/docs/guide/security/jsse/ReadDebug.html" rel="nofollow noreferrer">http://docs.oracle.com/javase/1.5.0/docs/guide/security/jsse/ReadDebug.html</a> I was able to understand that everthing goes accordingly until the part of finding a trusted certificate. Already checked if I added the certificate to the correct version of the jre and still have the same problem. </p>
  
  <p>Could the problem be solved with the website owner? It just because this won't be run only in my PC, so it is not convenient to configure everything again on every PC this runs. </p>