Jacob's final years, spent in Egypt, were the best of his life. He was surrounded by his reunited family and free from worry or enemies. Jacob was happy to see how Joseph had remained faithful to Jewish values even in Egypt.
Jacob lived 17 years in Egypt.
When Rabbi Menachem Mendel of Lubavitch (the Tzemach Tzedek) was a young boy, he asked the following of his grandfather, Rabbi Schneur Zalman of Liadi: "Granted, Jacob was happy to see how Joseph had remained faithful to Jewish values even in Egypt, the embodiment of decadence. But even so, how could the best years of Jacob's life be those that he lived in such a place?"
Rabbi Schneur Zalman's answer was that Jacob had sent Judah to set up a house of learning so the family could study the Torah in Egypt. When we study the Torah, we become closer to G-d. Studying the Torah in an environment of spiritual darkness transforms that darkness into light. This explains why Jacob lived his best years in the decadent society of Egypt.
This answer is especially relevant today. Our personal and collective world is limited and imperfect; we still live in "Egypt." But since G-d is beyond the limitations of our imperfect world, when we study the Torah and thereby connect with Him, we are not only immune to the negative effects of "Egypt" -- we are empowered to transform the darkness of exile into light.
Daily Wisdom #2