Adding my Self-Signed Certificate to the Trusted CAS List programatically

For my project, I need to add a self-assigned certificate to the trusted CA list so that browsers treat my server as secure connection. I have already produced the certificate using OpenSSL. Now, I need to add to the CA list. I tried to add the certificate manually by this command found from another question

sudo cp my.crt /usr/local/share/ca-certificates/
sudo update-ca-certificates

But both Mozilla and Chrome still showing the connection as insecure. I will be grateful if anyone can guide me on how I can do this programmatically in JAVA/python/C/C++ or any other language.

screenshot from chrome