The code at my current job is much better written, is more thoroughly tested, and is more pleasant to continue development on. The codebase at my previous job was a rat's nest, caused primarily by lower-skilled developers, no time allocated to technical debt or refactoring, a breakneck pace of product release, lack of a good automated testing suite, lack of good continuous integration and presubmits, and the weakly-typed/dynamic nature of JavaScript itself which doesn't scale well to larger server-side codebases.
So long as a given language/platform isn't deprecated (and Java definitely isn't), I'd rather work on a solid codebase in it than a weak codebase in a more alluring, recent language.