Still the bible does say that the only way to heaven is thought jesus Christ So once again if you have never heard of him why would you go to heaven?
Jesus said in Jn 9:
40Some Pharisees who were with him heard him say this and asked, "What? Are we blind too?" 41Jesus said,
"If you were blind, you would not be guilty of sin; but now that you claim you can see, your guilt remains.
To me, one of the many things this says is if you were blind, you would not be guilty of sin. In other words, one is not held accountable for not believing something they have never heard of. Yet, these Pharisees who saw Jesus heal the blind man and many other miracles will be held accountable (but now that you claim you can see [yet still reject Christ] your guilt remains.)
An example of a righteous man is Cornelius:
Acts 10 Cornelius Calls for Peter
1At Caesarea there was a man named
Cornelius, a centurion in what was known as the Italian Regiment.
2He and all his family were devout and God-fearing; he gave generously to those in need and prayed to God regularly. 3One day at about three in the afternoon he had a vision. He distinctly saw an angel of God, who came to him and said, "Cornelius!" 4Cornelius stared at him in fear. "What is it, Lord?" he asked.
The angel answered,
"Your prayers and gifts to the poor have come up as a memorial offering before God. 5Now send men to Joppa to bring back a man named Simon who is called Peter. 6He is staying with Simon the tanner, whose house is by the sea."
Jumping to the end of the story:
34Then Peter began to speak:
"I now realize how true it is that God does not show favoritism 35but accepts men from every nation who fear him and do what is right. 36You know the message God sent to the people of Israel, telling the good news of peace through Jesus Christ, who is Lord of all. 37You know what has happened throughout Judea, beginning in Galilee after the baptism that John preached— 38how God anointed Jesus of Nazareth with the Holy Spirit and power, and how he went around doing good and healing all who were under the power of the devil, because God was with him.
39"We are witnesses of everything he did in the country of the Jews and in Jerusalem. They killed him by hanging him on a tree, 40but God raised him from the dead on the third day and caused him to be seen. 41He was not seen by all the people, but by witnesses whom God had already chosen—by us who ate and drank with him after he rose from the dead. 42He commanded us to preach to the people and to testify that he is the one whom God appointed as judge of the living and the dead. 43All the prophets testify about him that everyone who believes in him receives forgiveness of sins through his name."
44While Peter was still speaking these words, the Holy Spirit came on all who heard the message. 45The circumcised believers who had come with Peter were astonished that the gift of the Holy Spirit had been poured out even on the Gentiles. 46For they heard them speaking in tongues[
b] and praising God. Then Peter said, 47"Can anyone keep these people from being baptized with water? They have received the Holy Spirit just as we have." 48So he ordered that they be baptized in the name of Jesus Christ. Then they asked Peter to stay with them for a few days.
As I said, God gives every man a conscience, meaning with knowledge, and a creation showing forth a Creator. Everyone can know when they have done wrong (sinned), and ask the Creator for forgiveness. Having heard the Gospel and trusted Christ, asking forgiveness and accepting the free gift of salvation by grace is far better, knowing we are assured that we have salvation, have passed from death to life, and will never again enter back into condemnation, kept by the power of God who redeemed us with his own blood.