Tag Archives: Java

Java Thread Not Created – run() or start() ?

Why is my Java thread not running?

A: Calling run() and start() are not the same.

start() – create a new thread. Now we have one main process and a thread executing concurrently.

run() – no new thread create. The main process go into the class of the thread and executes codes in the run() block. Now we have only one main process in the application.

run() is just a function in the class. start() is to ask the JVM to create a new thread first and uses this newly created thread to execute run() function.

So call start() when you want to create a new thread to execute your code concurrently.

javax.net.ssl.SSLException: Received fatal alert: bad record mac – Simple Solution

Recently, I encountered a Java exception called bad_record_mac while running a Java software that uses jsoup connection. 

After 1 hour of trial and error, I realized the website I am connecting allows only SSL 3.0 which previously is not.





To Solve This:

I added one properties line.

System.setProperty("https.protocols", "SSLv3,SSLv2Hello");

And now jsoup connection is able to connect properly using the correct HTTPS protocol. Note, don’t forget to include your SSL certificate as well when making connection.

System.setProperty("javax.net.ssl.trustStore", certPath);