KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I've set up a self-signed certificate to test an SSL Java connection. However, it is refusing to locate the Java trust store. I've saved copies of it in /Java/jre6/lib/security in addition to the folder where the classes are compiled to (I'm using NetBeans) and also to /java/jre6/bin. None of the above appears to work, because when I run the following, trustStore == null . public class ShowTrustStore { public static void main(String[] args) { System.setProperty("javax.net.ssl.keyStore", "keystore.jks"); System.setProperty("javax.net.ssl.trustStrore", "cacerts.jks"); System.setProperty("javax.net.ssl.keyStorePassword", "changeit"); String trustStore = System.getProperty("javax.net.ssl.trustStore"); if (trustStore == null) { System.out.println("javax.net.ssl.trustStore is not defined"); } else { System.out.println("javax.net.ssl.trustStore = " + trustStore); } } } How to set the path correctly? Using the getFile() method and some more debug data: package ssltest; public class Main { public static void main(String[] args) { // System.setProperty("javax.net.ssl.keyStore", "/keystore.jks"); // System.setProperty("javax.net.ssl.trustStrore", "/java.home/cacerts.jks"); // System.setProperty("javax.net.ssl.keyStorePassword", "changeit"); // System.setProperty("javax.net.ssl.trustStorePassword", "changeit"); try { Main.class.getResource("trustStore.jks").getFile(); } catch (Exception e) { e.printStackTrace(); } String trustStore = System.getProperty("javax.net.ssl.trust
Tags (comma-separated)
Save Edits
Cancel