Therefore I hated life; because the work that is wrought under the sun is grievous unto me: for all is vanity and vexation of spirit. Yea, I hated all my labour which I had taken under the sun: because I should leave it unto the man that shall be after me.
So, these are two verses that mostly say the same thing, right? In mostly the same words, right? But not completely the same words. So let's look at those words.
Verse 17 starts v'shanaytee et-ha-hayim, I hate the life. Verse 18 starts v'shanaytee anee et-col-amalee, I hate me all my work. The first difference is that while in the first verse Kohelet hates life because of the labor, in the second he hates the labor directly; let's come back to that one. The second difference is that the second verse emphasizes Kohelet himself with three, rather than one, identifiers. In 17 he hates the life, not my life, and in 18 he hates my labor, with an extra 'me' thrown in for emphasis (Hebrew uses repetition for emphasis all the time). In 17 we do later get what the KJV translates as grievous unto me, which is actually earlier in the sentence in Hebrew. The order is [And I hated the life] [because] [grievous unto me] [the work worked] [under the sun] [because] [everything] [futility and grasping wind]. In 18 it's [And I hated] [me] [all my labor] [that I labored] [under the sun] [we deposit] [to man] [what becomes] [after me]. That's five mes in the second verse and only two in the first—but more important, I think there's a tone in the second verse, that Kohelet hates his own labor because of its relation to him (and the inevitable end of that relationship). In the first verse, Kohelet hates the world, not just his own world or his part of it, but the objective world outside himself which is objectively all futility and grasping at winds.
Now back to the first big difference, which shows up in those first few words but is emphasized later, is that—guess what—come on, guess—yes, verse 17 is about asah and verse 18 is about amal. Ha-ma'aseh shena'asah in verse 17, the work worked. Kol amalee she-ani amal in verse 18, all my labor that I labored. I had differentiated those (for my purposes) such that amal is (in some sense) alienated labor and asah is (in some sense) unalienated labor—but for kohelet and for me there is a religious aspect to the distinction. Amal is the work you do for this world; asah is the work you do for the Divine. Or at least that is what I am playing with, anyway. So, if we take that reading, we now have two verses that are contrasting things, right?
17: And I hated the life, because I found bad the [alienated] work worked in this world (that is, under the sun); everything is futility and grasping the wind.
18: And I [even] hated the [unalienated] labour I laboured over in this world, which is laid down for whatever man follows me.
It's probably correct that follows is temporal here rather than referring to a follower of his teaching, although I think the connotation should stay. Kohelet doesn't just mean the next generation, but someone following in his footsteps, taking over his tasks.
OK, so what do we have here? I think there's something to my notions of contrast worth the interpretive wrestling. Alienated labor, the labor made for this world, is futile; the labor for the Divine in this world is not futile, but Kohelet still hates it. What else is there? The obvious answer is nothing, but I don't think that's correct. I think there is implied contrast with some sort of labor that is not under the sun. I could even argue that there's an implied contrast that if Kohelet hates the life, perhaps there is something else—in eighties slang, of course, it would make perfect sense to say you hate the life of evil work, because it is empty chasing after shadows and spirits, and it would be understood that you meant to get out of the life and settle down. I do like that echo, but I think we don't absolutely require it to say that what Kohelet hates is the life he had been talking about, the life of whatsoever mine eyes desired I kept not from them (2:10-11, where I got my idea about amal and asah). The life under the sun.
What work is not under the sun? What is the life that reaches up to the heavens? That, if we can find it, is the life and the work that we won't hate, that won't be screwed up by our followers or found to be grappling with ghosts. That is the work of the Divine—and maybe it isn't available for us mortal men, and that's the point, to keep in mind the humility of all our aspirations compared with the Divine Creation. Or perhaps there work for us humans that is not entirely under the sun at all.
Tolerabimus quod tolerare debemus,
-Vardibidian.