In the past couple of weeks, I've started to take up java again.
My recent java project involves taking business data from a website (phone number, address, company name, etc.), sorting through it, and inserting the data into an excel file on the user's desktop. I am not using this for anything (just to get back in the flow), but I might try something similar for financial market data. Anyways, the code itself works fine if I run it from the .jar file or through Eclipse.
However, when I try to create an executable file (through launch4j) and run it, it wasn't properly running as the jar file had. So I created another .exe file and changed it from GUI to console to debug the problem. I've listed the problem below.
Exception in thread "main" java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoader.java:61)
Caused by: java.lang.ExceptionInInitializerError
at java.base/javax.crypto.Cipher.getInstance(Cipher.java:548)
at java.base/sun.security.ssl.SSLCipher.isTransformationAvailable(SSLCipher.java:510)
at java.base/sun.security.ssl.SSLCipher.<init>(SSLCipher.java:499)
at java.base/sun.security.ssl.SSLCipher.<clinit>(SSLCipher.java:82)
at java.base/sun.security.ssl.CipherSuite.<clinit>(CipherSuite.java:69)
at java.base/sun.security.ssl.SSLContextImpl.getApplicableSupportedCipherSuites(SSLContextImpl.java:343)
at java.base/sun.security.ssl.SSLContextImpl$AbstractTLSContext.<clinit>(SSLContextImpl.java:556)
at java.base/java.lang.Class.forName0(Native Method)
at java.base/java.lang.Class.forName(Class.java:340)
at java.base/java.security.Provider$Service.getImplClass(Provider.java:1844)
at java.base/java.security.Provider$Service.newInstance(Provider.java:1820)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:236)
at java.base/sun.security.jca.GetInstance.getInstance(GetInstance.java:164)
at java.base/javax.net.ssl.SSLContext.getInstance(SSLContext.java:184)
at java.base/javax.net.ssl.SSLContext.getDefault(SSLContext.java:110)
at java.base/javax.net.ssl.SSLSocketFactory.getDefault(SSLSocketFactory.java:83)
at java.base/javax.net.ssl.HttpsURLConnection.getDefaultSSLSocketFactory(HttpsURLConnection.java:334)
at java.base/javax.net.ssl.HttpsURLConnection.<init>(HttpsURLConnection.java:291)
at java.base/sun.net.www.protocol.https.HttpsURLConnectionImpl.<init>(HttpsURLConnectionImpl.java:81)
at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:62)
at java.base/sun.net.www.protocol.https.Handler.openConnection(Handler.java:57)
at java.base/java.net.URL.openConnection(URL.java:1101)
at org.jsoup.helper.HttpConnection$Response.createConnection(HttpConnection.java:892)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:729)
at org.jsoup.helper.HttpConnection$Response.execute(HttpConnection.java:707)
at org.jsoup.helper.HttpConnection.execute(HttpConnection.java:297)
at org.jsoup.helper.HttpConnection.get(HttpConnection.java:286)
at SpiderTest.main(SpiderTest.java:64)
Looking through my code, it seems that the error occurs at Line 64, which is:
Document document = Jsoup.connect(url).get();
I've tried all other solutions on StackOverflow and other sites, and none of them seem to fix this issue. The main jar files I've used are Jsoup (for web) and Apache (for excel). I exported the excel project as a runnable jar file and packaged all required libraries into the generated jar. I'm at a loss on where to go, or if I'm an idiot.