Robert Lowry wrote the tune HOW CAN I KEEP FROM SINGING (also called ENDLESS SONG from the opening line of the first stanza) to accompany these words, and it appeared with the text in Bright Jewels in 1869. It was originally written in triple meter (3/2), but some modern hymnals have changed the tune to a slightly irregular duple meter (4/4) with a little syncopation. The tune is pentatonic with a consistent rhythmic pattern (in its original form), and works well when sung unaccompanied.
This hymn is all about perspective. It opens with an assertion that the troubles of this world are nothing when compared to the new creation that is to come. By keeping our focus on our Lord – that He is our Rock and that He lives – we can follow the admonition of the apostle James: “Count it all joy, my brothers, when you meet trials of various kinds” (James 1:2 ESV).