Java is still ok. A lot of people use it. It's a good ecosystem and well hung technology, the tooling is very good.
However, I think Java is not very popular because of Oracle and the licensing. There is no good reason to avoid it technology-wise but it has kind of a bad smell.
Another reason could be that more and more modern languages are trying to prevent using a VM and are designed as or transition into a compiled language offering "best" performance by having native binaries without too many dependencies.
The last reason I can think of is productiveness / complexity and elegance. Java just does not feel very elegant or easy to learn with its enterprise background. Too many products / libraries / technologies for beginners. Because of it's strictly object oriented design you have to write much code to achieve the same thing you can do in a few lines or even one line in other languages (even when you are using modern Java features). Kotlin comes in handy here, but still feels a bit clunky from time to time.
I would still use it, if it is the right tool for the job... or even if I didn't have skills in another language and wanted to get things done. Still it may be a good idea to check out other languages to learn something new. Python is good for AI stuff, Go was very productive. TypeScript is... well a "better" JavaScript with interesting concepts. Currently I'm learning Dart / Flutter, because C# failed hard while building my first little audio player app :-)