Some unfortunate moviegoers out there may remember the dire 1981 comedy “Neighbors,” in which John Belushi (in his last film) played a nebbishy suburbanite who was tormented by a creepy fellow (Dan Aykroyd) who moved in next to him. The Thomas Berger novel on which it was based was actually a solid piece, but the bombastic way in which the movie was played by the leads and directed by John G. Avildsen made it sheer torture to sit through. If you recall that catastrophe, watching “Envy,” about a middle-class guy who’s wracked with jealousy when his next-door neighbor (and best friend) gets rich off an absurd invention, will give you a sense of deja vu. Once again you suffer through a lame, heavy-handed, supposedly “dark” comedy about next-door neighbors, and once again two funny guys come up empty. Ben Stiller resembles Aykroyd: he takes the manic part and flounders in excess and exaggeration. Jack Black, on the other hand, is like Belushi in that he has to play against type, taming his normal hysteria to portray a more subdued (and decidedly mirthless) character than usual. And though Barry Levinson demonstrates a somewhat lighter touch than the fish-out-of-water Avildsen (who was more suited to stuff like the brutal 1970 melodrama “Joe”), under his direction the picture is relentlessly sluggish and overemphatic. “Envy” was kept on the shelf by the studio for some time, but one can’t attribute its stale, tasteless quality to the delay in releasing it; this is a movie that would never have been considered fresh.

As to the plot: Stiller plays Tim Dingman, who works with Black’s Nick Vanderpark at a sandpaper factory and, having gotten a promotion because of his “focus,” is planning on putting a small swimming pool in behind his ranch house in the Valley. Nick, by contrast, is an inveterate dreamer who’s constantly coming up with unlikely ideas for inventions. His latest notion is an aerosol spray that will make doggie doo literally disappear, and he enlists a chemist at the company to work on it with him. As the work proceeds, Nick offers Tim the chance to invest in the project, but Dingman understandably dismisses it as nonsense. Nonetheless, the stuff works, and quickly makes Nick a millionaire. He doesn’t move away, though. Instead he builds an opulent mansion across the street from Tim’s house, complete with a “Neverland”-style amusement park, and showers Dingman and his family with gifts. Tim feigns nonchalance about his buddy’s newfound wealth, but inwardly he’s seething, and before long he’s not only lost his job after exploding at the boss but has become estranged from his wife (Rachel Weisz), who’s constantly reminding him that they could have made a bundle too; and to make matters worse, he accidentally kills Nick’s beloved horse. Slapstick kicks in when he enlists a befuddled, alcoholic hippie-type bum (Christopher Walken) to dispose of the carcass–and when Nick’s dopey wife (Any Poehler) decides to run for public office, leading her opponent and his supporters to attack Vapoorizer and its inventor with the question, “Where does the s**t go?” Anybody unlucky enough to buy a ticket to “Envy” will have a pretty good idea of the right answer to that question.

This would be a pretty terrible idea for a movie in any event, but it’s made even worse by Steve Adams’ crummy writing (a long, extravagant monologue-confession for Stiller in the last reel is agonizingly unfunny, and there’s a totally extraneous sequence set in the swimming pool of the Italian presidential palace that’s simply grotesque) and by Levinson’s pedestrian direction, which allows things to play out at a virtually funereal pace and every script flaw to be spotlighted. Stiller, who’s been cruelly overexposed in a series of bad comedies, does his usual shtick here, but to no comic effect, and Black has to underplay so strenuously that he practically disappears. Weisz is stuck with a thoroughly unpleasant character–this woman is obsessed with material things to the extent of mistreating her husband at every opportunity–and Poehler is no more amusing than she is in “Mean Girls,” where she’s probably the weakest link in the cast. Even the ordinarily foolproof oddball antics of Walken fail to generate any amusement, partially because they’re staged so poorly. An episode in which he and Stiller transport the dead horse atop a van, for instance, comes across like a really bad imitation of the sequence in “National Lampoon’s Vacation” in which the deceased Aunt Edna is taken cross-country in similar fashion; the difference is that there it was funny. To add to the misery, there’s a perfectly dreadful score by Mark Mothersbaugh, which bounces and burbles so insistently that it might drive you nuts; and the lyrics to some songs added to the mix are even worse than the dialogue. Visually, the picture is quite ugly; no kudos to the technical crew.

Where’s that can of Vapoorizer when you really need it? Just aim it at the screen and push.