I am trying to get contents of a site using java. like this
    package javaTests;
    import java.io.BufferedReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.URL;
    import javax.net.ssl.HttpsURLConnection;
public class PrintContent {
    public static void main(String[] args) throws Exception {
        String https_url = "https://api.precharge.net/charge";
        URL url;
        url = new URL(https_url);
        HttpsURLConnection con = (HttpsURLConnection)url.openConnection();
        if(con!=null){
        try {
           System.out.println("****** Content of the URL ********");            
           BufferedReader br = 
            new BufferedReader(
                new InputStreamReader(con.getInputStream()));
           String input;
           while ((input = br.readLine()) != null){
              System.out.println(input);
           }
           br.close();
        } catch (IOException e) {
           e.printStackTrace();
        }
             }
    }
}
But i am getting exception like.
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Please give some suggestions to how to fix this. thank you in advace.
i tried copying the certificate to the security folder of java also. but it is not working. also tried installcerticate.java class.
 
    